Skip to content

Commit e941521

Browse files
committed
chore: allow specifying verison tag
1 parent d80b7a4 commit e941521

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ name: Publish to Docker Hub
99

1010
on:
1111
workflow_dispatch:
12+
inputs:
13+
version:
14+
description: "Version tag (e.g. 1.2.0). If empty, only 'latest' is pushed."
15+
required: false
1216
push:
1317
branches: [main]
1418
paths-ignore:
@@ -86,8 +90,12 @@ jobs:
8690
# Always include latest tag
8791
TAGS="${{ env.IMAGE_NAME }}:latest"
8892
89-
# Add version tag if version changed
90-
if [[ "${{ steps.check-version.outputs.VERSION_CHANGED }}" == "true" ]]; then
93+
# Add version tag: manual input takes precedence, then auto-detect from package.json
94+
if [[ -n "${{ inputs.version }}" ]]; then
95+
VERSION="${{ inputs.version }}"
96+
TAGS="$TAGS,${{ env.IMAGE_NAME }}:$VERSION"
97+
echo "Publishing with tags: latest, $VERSION (manual)"
98+
elif [[ "${{ steps.check-version.outputs.VERSION_CHANGED }}" == "true" ]]; then
9199
VERSION="${{ steps.check-version.outputs.VERSION }}"
92100
TAGS="$TAGS,${{ env.IMAGE_NAME }}:$VERSION"
93101
echo "Publishing with tags: latest, $VERSION"
@@ -106,6 +114,6 @@ jobs:
106114
tags: ${{ steps.prep.outputs.TAGS }}
107115
build-args: |
108116
GIT_COMMIT=${{ github.sha }}
109-
VERSION=${{ steps.check-version.outputs.VERSION }}
117+
VERSION=${{ inputs.version || steps.check-version.outputs.VERSION }}
110118
cache-from: type=gha
111119
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)