From 91b847ea9f0b17df753e083446b0457768bd68c2 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 16 Oct 2024 14:49:38 +0200 Subject: [PATCH] compute tag --- .github/workflows/multi-arch-image.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/multi-arch-image.yml b/.github/workflows/multi-arch-image.yml index 6314040b..4c3754a3 100644 --- a/.github/workflows/multi-arch-image.yml +++ b/.github/workflows/multi-arch-image.yml @@ -3,7 +3,13 @@ name: Build on: workflow_dispatch: push: + branches: + - main + tags: + - v* pull_request: + branches: + - main permissions: packages: write @@ -23,9 +29,22 @@ jobs: docker push ghcr.io/spack/manylinux2014:latest-$arch done - docker manifest create ghcr.io/spack/manylinux2014:example \ + # use tag pr-, latest, or v* tag for multi-arch image tag. + if [ -n "$GITHUB_REF" ]; then + if [ "$GITHUB_REF" = "refs/pull/${{ github.event.pull_request.number }}/merge" ]; then + tag_name=pr-${{ github.event.pull_request.number }} + elif [ "$GITHUB_REF" = "refs/heads/main" ]; then + tag_name=latest + else + tag_name=${GITHUB_REF/refs\/tags\//} + fi + else + tag_name=latest + fi + + docker manifest create ghcr.io/spack/manylinux2014:$tag_name \ ghcr.io/spack/manylinux2014:latest-x86_64 \ ghcr.io/spack/manylinux2014:latest-aarch64 \ ghcr.io/spack/manylinux2014:latest-ppc64le - docker manifest push ghcr.io/spack/manylinux2014:example \ No newline at end of file + docker manifest push ghcr.io/spack/manylinux2014:$tag_name \ No newline at end of file