name: Docker Publish on: push: branches: - 'master' tags: - 'v*.*.*' jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # Workaround: https://github.com/docker/build-push-action/issues/461 - name: Setup Docker buildx # https://github.com/docker/setup-buildx-action uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 # Login against Docker registry - name: Log into registry # https://github.com/docker/login-action uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} # Extract Docker image tag from git tag. E.g. if git tag is "v0.19.1" then use # Docker image tag "0.19.1". The "latest" tag reflects the most recent build on # master. - name: Extract Docker metadata id: meta # https://github.com/docker/metadata-action uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 with: images: docker.io/${{ secrets.DOCKERHUB_USERNAME }}/scryer-prolog tags: | type=semver,pattern={{version}} type=raw,value=latest,enable={{is_default_branch}} # type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} # Build and push Docker image with Buildx - name: Build and push Docker image id: build-and-push # https://github.com/docker/build-push-action uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 # v4 adds SLSA Provenance attestation which is # - unsupported by AWS Lambda # - limited support by Google Cloud Run # > If deploying a multi-architecture image, the manifest list must include linux/amd64. # see https://github.com/docker/build-push-action/releases/tag/v4.0.0 # we might want to disable this if its a problem for someone with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}