ci: restore latest.json updates for prerelease tags (#4903)

PR #4582 gated the update-latest-version job to stable release tags so prereleases could not overwrite the stable version pointer. But the project currently ships prerelease tags only (beta previews), so the job never runs and latest.json has been stale since. Run the job for every release tag again, and keep the honest half of the #4582 fix by writing release_type from the actual build type instead of hardcoding "stable".
This commit is contained in:
Zhengchao An
2026-07-16 17:39:56 +08:00
committed by GitHub
parent f5e715a8fd
commit d5baaa67b8
+13 -5
View File
@@ -848,12 +848,14 @@ jobs:
echo "✅ All assets uploaded successfully" echo "✅ All assets uploaded successfully"
# Update latest.json for stable releases only: prerelease tags (alpha/beta/ # Update latest.json for every release tag (stable and prerelease): the
# rc) must never overwrite the stable version pointer. # project currently ships prerelease tags only, so gating this to stable
# left the version pointer permanently stale. release_type records whether
# the pointed-to version is a prerelease.
update-latest-version: update-latest-version:
name: Update Latest Version name: Update Latest Version
needs: [ build-check, upload-release-assets ] needs: [ build-check, upload-release-assets ]
if: startsWith(github.ref, 'refs/tags/') && needs.build-check.outputs.build_type == 'release' if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update latest.json - name: Update latest.json
@@ -872,6 +874,12 @@ jobs:
VERSION="${{ needs.build-check.outputs.version }}" VERSION="${{ needs.build-check.outputs.version }}"
TAG="${{ needs.build-check.outputs.version }}" TAG="${{ needs.build-check.outputs.version }}"
if [[ "${{ needs.build-check.outputs.build_type }}" == "prerelease" ]]; then
RELEASE_TYPE="prerelease"
else
RELEASE_TYPE="stable"
fi
# Install ossutil # Install ossutil
OSSUTIL_VERSION="2.1.1" OSSUTIL_VERSION="2.1.1"
OSSUTIL_ZIP="ossutil-${OSSUTIL_VERSION}-linux-amd64.zip" OSSUTIL_ZIP="ossutil-${OSSUTIL_VERSION}-linux-amd64.zip"
@@ -892,7 +900,7 @@ jobs:
"version": "${VERSION}", "version": "${VERSION}",
"tag": "${TAG}", "tag": "${TAG}",
"release_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", "release_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"release_type": "stable", "release_type": "${RELEASE_TYPE}",
"download_url": "https://github.com/${{ github.repository }}/releases/tag/${TAG}" "download_url": "https://github.com/${{ github.repository }}/releases/tag/${TAG}"
} }
EOF EOF
@@ -900,7 +908,7 @@ jobs:
# Upload to OSS # Upload to OSS
"$OSSUTIL_BIN" cp latest.json oss://rustfs-version/latest.json --force "$OSSUTIL_BIN" cp latest.json oss://rustfs-version/latest.json --force
echo "✅ Updated latest.json for stable release $VERSION" echo "✅ Updated latest.json for ${RELEASE_TYPE} release $VERSION"
# Publish release (remove draft status) # Publish release (remove draft status)
publish-release: publish-release: