Skip to content

Commit 22b7d16

Browse files
committed
Fix REPOSITORY_BUILD_VERSION for scheduled tasks
1 parent 81e935c commit 22b7d16

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,17 @@ jobs:
145145
- name: Set REPOSITORY_BUILD_VERSION
146146
id: set_version
147147
run: |
148-
if [ "${{ github.ref_type }}" == "tag" ]; then
149-
# 1. Building from a tag (like a release)
150-
echo "🚀 Setting REPOSITORY_BUILD_VERSION to Tag"
151-
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
148+
if [[ "${{ github.ref_type }}" == "tag" || "${{ inputs.ref }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
149+
# Building from a tag (release or scheduled task)
150+
echo "🚀 Setting REPOSITORY_BUILD_VERSION to Tag + Run ID"
151+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
152+
VERSION="${{ github.ref_name }}"
153+
else
154+
VERSION="${{ inputs.ref }}"
155+
fi
156+
echo "REPOSITORY_BUILD_VERSION=${VERSION}-${{ github.run_id }}" >> $GITHUB_ENV
156157
else
157-
# 3. Regular git build (PR, branch push, etc)
158+
# Regular git build (PR, branch push, etc)
158159
echo "👨‍🔬 Setting REPOSITORY_BUILD_VERSION to Git SHA + Run ID"
159160
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
160161
echo "REPOSITORY_BUILD_VERSION=git-${SHORT_SHA}-${{ github.run_id }}" >> $GITHUB_ENV

0 commit comments

Comments
 (0)