Skip to content

Commit 0c1e313

Browse files
feat: add workflow_dispatch to Docker workflow for manual triggers (#358)
Allows manual triggering of Docker builds when automatic tag triggers fail. This is useful when GitHub Actions doesn't process tag push events correctly.
1 parent f45ead2 commit 0c1e313

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/docker.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- "v*"
7+
workflow_dispatch:
78

89
env:
910
REGISTRY: docker.io
@@ -23,7 +24,16 @@ jobs:
2324
- name: Extract version
2425
id: version
2526
run: |
26-
VERSION=${GITHUB_REF#refs/tags/v}
27+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
28+
# For manual dispatch, use the current ref name or latest tag
29+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
30+
VERSION=${GITHUB_REF#refs/tags/v}
31+
else
32+
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0")
33+
fi
34+
else
35+
VERSION=${GITHUB_REF#refs/tags/v}
36+
fi
2737
echo "version=$VERSION" >> $GITHUB_OUTPUT
2838
echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
2939
echo "minor=$(echo $VERSION | cut -d. -f1-2)" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)