Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit d690e49

Browse files
authored
Merge pull request #237 from al-abd/dev
publish latest on main branch only
2 parents 4336128 + eddf456 commit d690e49

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/docker-publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,20 @@ jobs:
2424
- name: Set up Docker Buildx
2525
uses: docker/setup-buildx-action@v2
2626

27+
- name: Set Docker tags
28+
id: set_tags
29+
run: |
30+
base_tag="${{ secrets.DOCKER_HUB_USERNAME }}/nq-api"
31+
if [[ "${GITHUB_REF##*/}" == "main" ]]; then
32+
echo "tags=${base_tag}:latest" >> $GITHUB_ENV
33+
else
34+
echo "tags=${base_tag}:${GITHUB_REF##*/}" >> $GITHUB_ENV
35+
fi
36+
2737
- name: Build and push
2838
uses: docker/build-push-action@v3
2939
with:
3040
context: .
3141
file: ./Dockerfile
3242
push: true
33-
tags: |
34-
${{ secrets.DOCKER_HUB_USERNAME }}/nq-api:latest
35-
${{ secrets.DOCKER_HUB_USERNAME }}/nq-api:${{ github.ref_name }}
43+
tags: ${{ env.tags }}

0 commit comments

Comments
 (0)