Skip to content

Commit c8695f7

Browse files
committed
Adding logic for the Image tag prefix
Signed-off-by: Anushka <anush159@in.ibm.com>
1 parent d0c06e4 commit c8695f7

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

.github/workflows/docker-release.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ jobs:
5656
- name: Build cross-architecture binaries
5757
run: make build-arch
5858

59+
- name: Print GitHub Repository Owner
60+
run: echo "Repository owner is ${{ github.repository_owner }}"
61+
62+
- name: Set image prefix
63+
run: |
64+
if [ "${{ github.repository_owner }}" = "hyperledger" ]; then
65+
echo "IMAGE_PREFIX=hyperledger" >> $GITHUB_ENV
66+
else
67+
echo "IMAGE_PREFIX=${{ secrets.DOCKERHUB_USERNAME }}" >> $GITHUB_ENV
68+
fi
69+
5970
- name: Build and Push Multi-Platform Docker Image for Committer
6071
uses: docker/build-push-action@v6
6172
with:
@@ -64,11 +75,11 @@ jobs:
6475
platforms: linux/amd64,linux/arm64,linux/s390x
6576
push: true
6677
tags: |
67-
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/fabric-x-committer:latest
68-
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/fabric-x-committer:${{ env.VERSION }}
78+
docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:latest
79+
docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:${{ env.VERSION }}
6980
build-args: |
7081
BIN=committer
7182
ARCHBIN_PATH=archbin
7283
PORTS=4001 2114 9001 2119 5001 2115 6001 2116 7001 2117
73-
cache-from: type=registry,ref=docker.io/${{ secrets.DOCKERHUB_USERNAME }}/fabric-x-committer:buildcache
74-
cache-to: type=registry,ref=docker.io/${{ secrets.DOCKERHUB_USERNAME }}/fabric-x-committer:buildcache,mode=max
84+
cache-from: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:buildcache
85+
cache-to: type=registry,ref=docker.io/${{ env.IMAGE_PREFIX }}/fabric-x-committer:buildcache,mode=max

0 commit comments

Comments
 (0)