From d933fd497255f75c3bb9b0c7c37b75a12e33ee47 Mon Sep 17 00:00:00 2001 From: Ben Courliss Date: Fri, 11 Aug 2023 12:51:19 -0400 Subject: [PATCH] Issue #695 - Updated to support adding branch name to testing tags Signed-off-by: Ben Courliss --- .github/workflows/build-push.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index d2ee2b13..89e34287 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -14,6 +14,7 @@ env: IMAGE_REPO: ${{ vars.DOCKERHUB_REPO }} GITHUB_CONTAINER_REGISTRY: ghcr.io/${{ github.repository_owner }} BUILD_NUMBER: ${{ github.run_number }} + GH_BRANCH: ${{ github.ref_name }} # Jobs that will run when the workflow is triggered jobs: @@ -106,9 +107,11 @@ jobs: - name: Publish Image to Dockerhub run: | docker tag openhorizon/amd64_exchange-api:${IMAGE_VERSION} ${IMAGE_REPO}/amd64_exchange-api:testing - if [[ "$GITHUB_REF" == 'refs/heads/master' ]]; then \ - docker push ${IMAGE_REPO}/amd64_exchange-api:testing; \ - docker tag ${IMAGE_REPO}/amd64_exchange-api:testing ${GITHUB_CONTAINER_REGISTRY}/amd64_exchange-api:testing; \ - docker push ${GITHUB_CONTAINER_REGISTRY}/amd64_exchange-api:testing; \ - fi - \ No newline at end of file + if [[ "$GITHUB_REF" == 'refs/heads/master' ]]; then + docker push ${IMAGE_REPO}/amd64_exchange-api:testing + docker tag ${IMAGE_REPO}/amd64_exchange-api:testing ${GITHUB_CONTAINER_REGISTRY}/amd64_exchange-api:testing + docker push ${GITHUB_CONTAINER_REGISTRY}/amd64_exchange-api:testing + else + docker tag ${IMAGE_REPO}/amd64_exchange-api:testing ${IMAGE_REPO}/amd64_exchange-api:testing_${GH_BRANCH} + docker push ${IMAGE_REPO}/amd64_exchange-api:testing_${GH_BRANCH} + fi \ No newline at end of file