Skip to content

Commit

Permalink
fix: merging digests with actions/upload-artifact@v4
Browse files Browse the repository at this point in the history
v4 doesn't allow uploading to the same entry multiple times, so you need
to upload to separate ones and then merge them manually. In this case we
just glob and download all artifacts matching the pattern (as
recommended in the documentation).

To be able to use the matrix value in the artifact name we needed to
remove the slash.
  • Loading branch information
nico-famedly committed Jan 31, 2024
1 parent d018c63 commit ee60760
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
- amd64
- arm64
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
context: .
push: ${{ inputs.push }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platform }}
platforms: linux/${{ matrix.platform }}
build-args: ${{ inputs.build_args }}
cache-from: type=gha
cache-to: type=gha,mode=max
Expand All @@ -123,7 +123,7 @@ jobs:
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ inputs.registry }}-${{ inputs.image_name }}-${{ steps.tag.outputs.tags }}
name: digests-${{ inputs.registry }}-${{ inputs.image_name }}-${{ steps.tag.outputs.tags }}-${{ matrix.platform }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
Expand All @@ -138,8 +138,9 @@ jobs:
- name: Download digests
uses: actions/download-artifact@v4
with:
name: digests-${{ inputs.registry }}-${{ inputs.image_name }}-${{ needs.docker.outputs.tags }}
path: /tmp/digests
pattern: digests-${{ inputs.registry }}-${{ inputs.image_name }}-${{ needs.docker.outputs.tags }}-*
merge-multiple: true

- name: Set up Docker Buildx
uses: famedly/setup-buildx-action@v2
Expand Down

0 comments on commit ee60760

Please sign in to comment.