diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 3532b1d6..3c749349 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -62,7 +62,6 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2 - name: Login to GHCR - if: github.event_name != 'pull_request' uses: docker/login-action@v2 with: registry: ghcr.io @@ -76,18 +75,16 @@ jobs: context: . platforms: ${{ matrix.docker_build_arch }} labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=ghcr.io/${{env.REPOSITORY_LC}},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }} + outputs: type=image,name=ghcr.io/${{env.REPOSITORY_LC}},push-by-digest=true,name-canonical=true,push=true cache-from: type=gha cache-to: type=gha,mode=max - name: Export digest - if: github.event_name != 'pull_request' run: | mkdir -p /tmp/digests digest="${{ steps.build-and-push.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" - name: Upload digest - if: github.event_name != 'pull_request' uses: actions/upload-artifact@v3 with: name: digests @@ -106,17 +103,14 @@ jobs: env: REPOSITORY: '${{ github.repository }}' - name: Download digests - if: github.event_name != 'pull_request' uses: actions/download-artifact@v3 with: name: digests path: /tmp/digests - name: Set up Docker Buildx - if: github.event_name != 'pull_request' uses: docker/setup-buildx-action@v2 - name: Docker meta id: meta - if: github.event_name != 'pull_request' uses: docker/metadata-action@v4 with: # generate Docker tags based on the following events/attributes @@ -132,18 +126,15 @@ jobs: images: ghcr.io/${{env.REPOSITORY_LC}} - name: Login to Docker Hub uses: docker/login-action@v2 - if: github.event_name != 'pull_request' with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Create manifest list and push working-directory: /tmp/digests - if: github.event_name != 'pull_request' run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf 'ghcr.io/${{env.REPOSITORY_LC}}@sha256:%s ' *) - name: Inspect image - if: github.event_name != 'pull_request' run: | docker buildx imagetools inspect ghcr.io/${{env.REPOSITORY_LC}}:${{ steps.meta.outputs.version }}