mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 11:59:29 +00:00
fix: eliminate release race condition causing 404 on cloud bundle downloads (#2475)
The cli-release workflow was deleting releases before recreating them, leaving a window where users downloading cloud bundles (gcp.js, aws.js, etc.) would get a 404. This affected all clouds on every push to main. Switch to gh release upload --clobber which atomically replaces assets without removing the release, and only create releases if they don't already exist. Co-authored-by: lab <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6377b58bc1
commit
7af389387d
1 changed files with 12 additions and 15 deletions
27
.github/workflows/cli-release.yml
vendored
27
.github/workflows/cli-release.yml
vendored
|
|
@ -49,12 +49,8 @@ jobs:
|
|||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Delete existing release if present
|
||||
gh release delete cli-latest --yes 2>/dev/null || true
|
||||
git tag -d cli-latest 2>/dev/null || true
|
||||
git push origin :refs/tags/cli-latest 2>/dev/null || true
|
||||
|
||||
# Create new release with built cli.js and version file
|
||||
# Create release if it doesn't exist, then upload assets with --clobber
|
||||
# to atomically replace files without a delete→create race window
|
||||
gh release create cli-latest \
|
||||
--title "CLI v${{ steps.version.outputs.version }}" \
|
||||
--notes "Pre-built CLI binary (auto-updated on every push to main).
|
||||
|
|
@ -64,23 +60,23 @@ jobs:
|
|||
|
||||
**Version:** ${{ steps.version.outputs.version }}
|
||||
**Built:** $(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||
--prerelease \
|
||||
--prerelease 2>/dev/null || true
|
||||
|
||||
gh release upload cli-latest \
|
||||
packages/cli/cli.js \
|
||||
packages/cli/version
|
||||
packages/cli/version \
|
||||
--clobber
|
||||
|
||||
- name: Upload cloud bundles
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Upload each cloud bundle as a separate release (aws-latest/aws.js, etc.)
|
||||
# Upload each cloud bundle, creating the release if needed.
|
||||
# Uses --clobber to atomically replace assets (no delete→create race).
|
||||
for bundle in packages/cli/*.js; do
|
||||
name=$(basename "$bundle" .js)
|
||||
[[ "$name" == "cli" ]] && continue # skip cli.js, already uploaded above
|
||||
|
||||
gh release delete "${name}-latest" --yes 2>/dev/null || true
|
||||
git tag -d "${name}-latest" 2>/dev/null || true
|
||||
git push origin ":refs/tags/${name}-latest" 2>/dev/null || true
|
||||
|
||||
gh release create "${name}-latest" \
|
||||
--title "${name} bundle v${{ steps.version.outputs.version }}" \
|
||||
--notes "Pre-built ${name} cloud provider bundle.
|
||||
|
|
@ -88,6 +84,7 @@ jobs:
|
|||
Downloaded by \`sh/${name}/*.sh\` shims for \`bash <(curl ...)\` execution.
|
||||
|
||||
**Built:** $(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||
--prerelease \
|
||||
"$bundle"
|
||||
--prerelease 2>/dev/null || true
|
||||
|
||||
gh release upload "${name}-latest" "$bundle" --clobber
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue