Skip to content

Commit 12c4f74

Browse files
committed
👷 Differentiate between Git branches and tags for Docker tags
1 parent 16f4781 commit 12c4f74

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/build_C-PAC.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
username: ${{ github.actor }}
3333
password: ${{ secrets.GITHUB_TOKEN }}
3434
- name: Set tag & Dockerfile
35+
if: github.ref_type == 'branch'
3536
run: |
3637
if [[ "${{ inputs.variant }}" != "" ]]
3738
then
@@ -66,6 +67,24 @@ jobs:
6667
echo DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]'):$TAG >> $GITHUB_ENV
6768
echo DOCKERFILE="${DOCKERFILE}" >> $GITHUB_ENV
6869
cat $GITHUB_ENV
70+
- name: Set tag & Dockerfile
71+
if: github.ref_type == 'tag'
72+
run: |
73+
if [[ "${{ inputs.variant }}" != "" ]]
74+
then
75+
VARIANT=-${{ inputs.variant }}
76+
fi
77+
TAG=latest
78+
if [[ $VARIANT == "" ]]
79+
then
80+
DOCKERFILE=Dockerfile
81+
else
82+
DOCKERFILE=variant$VARIANT.Dockerfile
83+
fi
84+
TAG=$TAG$VARIANT
85+
echo DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]'):$TAG >> $GITHUB_ENV
86+
echo DOCKERFILE="${DOCKERFILE}" >> $GITHUB_ENV
87+
cat $GITHUB_ENV
6988
- name: Prep Dockerfiles for forked repository
7089
if: ${{ github.repository_owner }} != 'FCP-INDI'
7190
run: .github/scripts/local_ghcr $DOCKERFILE ${{ github.repository_owner }} $DOCKER_TAG

0 commit comments

Comments
 (0)