Skip to content

Commit 72e5f57

Browse files
committed
Add manually triggered Docker Hub publish
1 parent dd70eb0 commit 72e5f57

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/docker-push-image.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Push OpenSIPS Python Images in Docker Hub
1+
name: Push OpenSIPS Python Images to Docker Hub
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
jobs:
88
build:
99
runs-on: ubuntu-latest
10-
if: startsWith(github.ref, 'refs/tags/') # only publish to Docker Hub on tag pushes
10+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
1111

1212
steps:
1313
- uses: actions/checkout@v3
@@ -18,11 +18,22 @@ jobs:
1818
username: ${{ secrets.DOCKER_USERNAME }}
1919
password: ${{ secrets.DOCKER_TOKEN }}
2020

21+
- name: Get latest tag if manually triggered
22+
id: get_tag
23+
run: |
24+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
25+
git fetch --tags
26+
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
27+
echo "tag=$LATEST_TAG" >> $GITHUB_ENV
28+
else
29+
echo "tag=${{ github.ref_name }}" >> $GITHUB_ENV
30+
fi
31+
2132
- name: Build and push Docker image
2233
uses: docker/build-push-action@v4
2334
with:
2435
context: .
2536
push: true
2637
tags: |
2738
opensips/python-opensips:latest
28-
opensips/python-opensips:${{ github.ref_name }}
39+
opensips/python-opensips:${{ env.tag }}

0 commit comments

Comments
 (0)