Skip to content

Commit 5a421c5

Browse files
authored
feat(ci): enhance version tagging for develop branch builds (#163)
1 parent 85dc2f0 commit 5a421c5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/release.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ jobs:
137137
flavor: |
138138
latest=auto
139139
140+
- name: Get version info
141+
id: version
142+
run: |
143+
VERSION="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
144+
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
145+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
146+
SHORT_SHA=$(git rev-parse --short HEAD)
147+
VERSION="${LATEST_TAG}-develop-${SHORT_SHA}"
148+
fi
149+
echo "Version: ${VERSION}"
150+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
151+
140152
- name: Set up QEMU
141153
uses: docker/setup-qemu-action@v3
142154

@@ -157,7 +169,7 @@ jobs:
157169
labels: ${{ steps.meta.outputs.labels }}
158170
build-args: |
159171
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
160-
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
172+
VERSION=${{ steps.version.outputs.version }}
161173
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
162174
cache-from: type=gha
163175
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)