Skip to content

Commit

Permalink
action: publish manifest for multiple tags
Browse files Browse the repository at this point in the history
The PR #584 overlooked a scenario involving more than two elements
in `steps.meta.outputs.tags`. This commit addresses that by iterating
over the tags and creating/pushing a manifest for them, respectively.

Fixes: #583

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
  • Loading branch information
BbolroC committed Mar 18, 2024
1 parent 81119b8 commit 4047383
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,16 @@ jobs:
echo "NYDUS_STABLE_VER=$NYDUS_STABLE_VER" >> "$GITHUB_ENV"
printf 'nydus version is: %s\n' "$NYDUS_STABLE_VER"
- name: build and push nydus-snapshotter image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: misc/snapshotter
file: misc/snapshotter/Dockerfile
push: true
platforms: ${{ matrix.build-os }}/${{ matrix.build-arch }}
tags: ${{ steps.meta.outputs.tags }}-${{ matrix.build-arch }}
provenance: false
tags: |
${{ fromJSON(steps.meta.outputs.json).tags[0] }}-${{ matrix.build-arch }}
${{ fromJSON(steps.meta.outputs.json).tags[1] }}-${{ matrix.build-arch }}
labels: ${{ steps.meta.outputs.labels }}
build-args: NYDUS_VER=${{ env.NYDUS_STABLE_VER }}

Expand All @@ -169,9 +172,17 @@ jobs:
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set steps.meta.outputs.tags as environment variable
run: |
echo "TAGS=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ',')" >> "$GITHUB_ENV"
- name: Publish manifest for multi-arch image
run: |
docker manifest create ${{ steps.meta.outputs.tags }} \
--amend ${{ steps.meta.outputs.tags }}-amd64 --amend ${{ steps.meta.outputs.tags }}-arm64 \
--amend ${{ steps.meta.outputs.tags }}-s390x --amend ${{ steps.meta.outputs.tags }}-ppc64le
docker manifest push ${{ steps.meta.outputs.tags }}
IFS=',' read -ra tags <<< "$TAGS"
for tag in "${tags[@]}"; do
docker manifest create "${tag}" \
--amend "${tag}-amd64" \
--amend "${tag}-arm64" \
--amend "${tag}-s390x" \
--amend "${tag}-ppc64le"
docker manifest push "${tag}"
done

0 comments on commit 4047383

Please sign in to comment.