Update README.md #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
retag-docker-image: | |
runs-on: ubuntu-latest | |
name: Push updated Docker image | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Extract version | |
id: extract_version | |
uses: Saionaro/[email protected] | |
- name: Set environment variables | |
run: | | |
echo VERSION=${{ steps.extract_version.outputs.version }} >> $GITHUB_ENV | |
echo IMAGE_NAME=$REGISTRY/$(echo ${GITHUB_REPOSITORY,,}) >> $GITHUB_ENV | |
echo COMMITED_AT=$(git show -s --format=%cI `git rev-parse HEAD`) >> $GITHUB_ENV | |
echo REVISION=$(git rev-parse --short HEAD) >> $GITHUB_ENV | |
- name: Collect Docker image metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
labels: | | |
org.opencontainers.image.created=${{ env.COMMITED_AT }} | |
org.opencontainers.image.version=v${{ env.VERSION }} | |
org.opencontainers.image.maintainer=$({github.repository_owner}) | |
tags: | | |
type=semver,pattern={{version}},value=v${{ env.VERSION }} | |
- name: Log in to the GitHub container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
build-args: | | |
VERSION=${{ env.VERSION }} | |
REVISION=${{ env.REVISION }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:edge | |
cache-to: type=inline |