Skip to content

Commit 4821374

Browse files
committed
feat: update dev build versioning to use semver-compatible pre-release tags
- Change from dev-timestamp-sha to 0.0.0-dev.commitsSinceLastRelease.sha format - Use git to count commits since last release tag - Maintains semver compatibility while providing meaningful build numbers
1 parent 7e2f3b4 commit 4821374

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,24 @@ jobs:
121121
- name: Generate dev tag
122122
id: meta
123123
run: |
124-
# Create a dev tag with commit SHA and timestamp
124+
# Create a semver-compatible dev tag with commits since last release and commit SHA
125125
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
126-
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
127-
DEV_TAG="dev-${TIMESTAMP}-${SHORT_SHA}"
126+
127+
# Get the last release tag (excluding pre-release tags)
128+
LAST_TAG=$(git describe --tags --abbrev=0 --match="v[0-9]*.[0-9]*.[0-9]*" 2>/dev/null || echo "")
129+
130+
if [ -z "$LAST_TAG" ]; then
131+
# No release tags found, count all commits
132+
COMMIT_COUNT=$(git rev-list --count HEAD)
133+
else
134+
# Count commits since last release
135+
COMMIT_COUNT=$(git rev-list --count ${LAST_TAG}..HEAD)
136+
fi
137+
138+
DEV_TAG="0.0.0-dev.${COMMIT_COUNT}.${SHORT_SHA}"
128139
echo "dev_tag=${DEV_TAG}" >> $GITHUB_OUTPUT
140+
echo "Last release tag: ${LAST_TAG:-'none'}"
141+
echo "Commits since last release: ${COMMIT_COUNT}"
129142
echo "Generated dev tag: ${DEV_TAG}"
130143
131144
- name: Extract metadata

0 commit comments

Comments
 (0)