Skip to content

Commit 34192bf

Browse files
committed
correct tag
1 parent dbfcf84 commit 34192bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/workflows/docker.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
env:
1010
REGISTRY: ghcr.io
1111
IMAGE_NAME: ${{ github.repository }}
12+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
1213

1314
jobs:
1415
test:
@@ -57,9 +58,9 @@ jobs:
5758

5859
- name: Make tag
5960
run: |
60-
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
61+
[ "${GITHUB_EVENT_NAME}" == 'push' && "${BRANCH_NAME}" == 'main' ] && echo "tag=latest" >> $GITHUB_ENV || true
62+
[ "${GITHUB_EVENT_NAME}" == 'pull_request' || "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
6163
[ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
62-
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=latest" >> $GITHUB_ENV || true
6364
6465
- name: Build and push image
6566
uses: docker/build-push-action@v6

0 commit comments

Comments
 (0)