Skip to content

Commit 2265b2b

Browse files
committed
feat: add publish on release and proper tags
1 parent 691b925 commit 2265b2b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/docker-publish.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Build and Publish Docker Image
33
on:
44
push:
55
branches: [main]
6+
release:
7+
types: [published]
68

79
jobs:
810
docker-build-publish:
@@ -17,18 +19,27 @@ jobs:
1719
uses: actions/checkout@v6
1820

1921
- name: Log in to Docker Hub
20-
if: github.ref == 'refs/heads/main' && github.repository == 'finos/git-proxy'
22+
if: github.repository == 'finos/git-proxy'
2123
uses: docker/login-action@v3
2224
with:
2325
username: finos
2426
password: ${{ secrets.DOCKER_PASSWORD }}
2527

28+
- name: Set Docker Image Tag
29+
id: tags
30+
run: |
31+
if [ "${{ github.event_name }}" = "release" ]; then
32+
echo "tags=finos/git-proxy:${{ github.ref_name }},finos/git-proxy:latest" >> $GITHUB_OUTPUT
33+
else
34+
echo "tags=finos/git-proxy:main" >> $GITHUB_OUTPUT
35+
fi
36+
2637
- name: Build and Publish Docker Image
27-
if: github.ref == 'refs/heads/main' && github.repository == 'finos/git-proxy'
38+
if: github.repository == 'finos/git-proxy'
2839
uses: docker/build-push-action@v6
2940
with:
3041
context: .
3142
file: Dockerfile
3243
push: true
33-
tags: finos/git-proxy:latest
44+
tags: ${{ steps.tags.outputs.tags }}
3445
provenance: true

0 commit comments

Comments
 (0)