Harden RC release schedule against dropped cron runs
This commit is contained in:
parent
6a87496498
commit
95db2fd11f
|
|
@ -3,7 +3,7 @@ name: Schedule RC Release
|
|||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 3,15 * * *'
|
||||
- cron: '7,17,27 3,15 * * *'
|
||||
timezone: 'America/Los_Angeles'
|
||||
|
||||
permissions:
|
||||
|
|
@ -36,11 +36,35 @@ jobs:
|
|||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Sync with latest main
|
||||
run: git pull --ff-only origin main
|
||||
run: |
|
||||
git fetch origin main --tags
|
||||
git checkout main
|
||||
git reset --hard origin/main
|
||||
|
||||
- name: Compute RC slot
|
||||
id: slot
|
||||
run: |
|
||||
slot=$(TZ=America/Los_Angeles date '+%Y-%m-%d-%H')
|
||||
echo "value=$slot" >>"$GITHUB_OUTPUT"
|
||||
|
||||
- name: Skip if this PT release window already ran
|
||||
id: existing
|
||||
run: |
|
||||
# Why: GitHub can delay or drop schedule events, especially near the
|
||||
# start of the hour. We schedule multiple attempts inside each target
|
||||
# PT hour and make the release idempotent per hour by embedding a
|
||||
# slot marker in the release commit message.
|
||||
if git log origin/main --grep="\\[rc-slot:${{ steps.slot.outputs.value }}\\]" -n 1 --format=%H | grep -q .; then
|
||||
echo "already_ran=true" >>"$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "already_ran=false" >>"$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create and push RC tag
|
||||
if: steps.existing.outputs.already_ran != 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
npm version prerelease --preid=rc
|
||||
npm version prerelease --preid=rc -m "release: %s [rc-slot:${{ steps.slot.outputs.value }}]"
|
||||
git push origin main --follow-tags
|
||||
|
|
|
|||
Loading…
Reference in New Issue