Skip to content

Commit 9af8d65

Browse files
committed
Enhance version tagging logic in GitHub Actions workflow
- Add support for scheduled task builds with version-like input - Improve version generation comments for clarity - Maintain existing version generation strategies for tags and git builds
1 parent c06e9fe commit 9af8d65

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/service_docker-build-and-publish.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,16 @@ jobs:
146146
id: set_version
147147
run: |
148148
if [ "${{ github.ref_type }}" == "tag" ]; then
149+
# 1. Building from a tag (like a release)
149150
echo "🚀 Setting REPOSITORY_BUILD_VERSION to Tag"
150151
echo "REPOSITORY_BUILD_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
152+
elif [[ "${{ inputs.ref }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
153+
# 2. Building from scheduled task (using latest tag)
154+
echo "📅 Setting REPOSITORY_BUILD_VERSION to Tag + Run ID"
155+
echo "REPOSITORY_BUILD_VERSION=${{ inputs.ref }}-${{ github.run_id }}" >> $GITHUB_ENV
151156
else
152-
echo "👨‍🔬 Setting REPOSITORY_BUILD_VERSION to GIT Short SHA and GitHub Run ID"
157+
# 3. Regular git build (PR, branch push, etc)
158+
echo "👨‍🔬 Setting REPOSITORY_BUILD_VERSION to Git SHA + Run ID"
153159
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
154160
echo "REPOSITORY_BUILD_VERSION=git-${SHORT_SHA}-${{ github.run_id }}" >> $GITHUB_ENV
155161
fi

0 commit comments

Comments
 (0)