fix: Reset release sequence number to 0 on each new date
Per spec: the sequence number is a per-day counter that resets on date change and starts at 0, not 1. The first release of a day is quant_YYYYMMDD.0.hash, the second .1, etc. Previous commit fixed *counting* today's releases via the Gitea API (instead of the always-empty local git tags from a shallow checkout), but still added +1 on top, which would have produced 1, 2, 3... for the first, second, third releases of a day instead of 0, 1, 2. DEPLOY_COUNT is now just RELEASES_TODAY directly.
This commit is contained in:
@@ -4,7 +4,7 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Release version (auto-generated if empty, e.g. quant_20260711.1.abc1234)'
|
||||
description: 'Release version (auto-generated if empty, e.g. quant_20260711.0.abc1234 for the first deploy that day)'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
@@ -49,11 +49,13 @@ jobs:
|
||||
# "quant_20260711.1.*" (three of them: b7591fb, 6ab270f,
|
||||
# e49922e, all claiming to be deploy #1). Query the actual
|
||||
# Gitea Releases API instead, which reflects real state.
|
||||
# Sequence number resets to 0 on each new date -- the first
|
||||
# release of a day is quant_YYYYMMDD.0.hash, the second .1, etc.
|
||||
RELEASES_TODAY=$(curl -sf --connect-timeout 10 --max-time 30 \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://gitea.taxbaik.com/api/v1/repos/${{ github.repository }}/tags?limit=50" \
|
||||
| jq -r --arg prefix "quant_${TODAY}." '[.[] | select(.name | startswith($prefix))] | length')
|
||||
DEPLOY_COUNT=$((RELEASES_TODAY + 1))
|
||||
DEPLOY_COUNT=$RELEASES_TODAY
|
||||
|
||||
VERSION="quant_${TODAY}.${DEPLOY_COUNT}.${COMMIT}"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user