diff --git a/.gitea/workflows/prepare-release.yml b/.gitea/workflows/prepare-release.yml index 02202fd8..befd7830 100644 --- a/.gitea/workflows/prepare-release.yml +++ b/.gitea/workflows/prepare-release.yml @@ -56,39 +56,17 @@ jobs: - name: Generate Metadata id: metadata - env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | VERSION_INPUT="${{ github.event.inputs.version }}" COMMIT=$(git rev-parse --short HEAD) # Auto-generate version if not provided if [ -z "$VERSION_INPUT" ]; then - # This project operates on Korea Standard Time (production - # server logs, ops schedule, and the team are all KST) -- - # using UTC here silently rolled the date back by up to 9 - # hours (e.g. 2026-07-12 01:xx KST is still 2026-07-11 16:xx - # UTC), so a release cut right after midnight KST would tag - # itself with yesterday's date. - TODAY=$(TZ=Asia/Seoul date +%Y%m%d) - - # NOTE: Do NOT count today's releases via `git tag -l` here. - # actions/checkout@v4 defaults to a shallow, single-branch - # clone that does not fetch any tags, so every job container - # sees zero local tags regardless of how many releases exist - # -- this is exactly why every release tonight came out as - # "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 - - VERSION="quant_${TODAY}.${DEPLOY_COUNT}.${COMMIT}" + # Simple, reliable version scheme: timestamp + commit hash + # Avoids unreliable Gitea API calls (network failures, timeouts) + # Format: v0.1.YYYYMMDD.HHMMSS.COMMIT + TIMESTAMP=$(TZ=Asia/Seoul date +%Y%m%d.%H%M%S) + VERSION="v0.1.${TIMESTAMP}.${COMMIT}" else VERSION="$VERSION_INPUT" fi