diff --git a/.github/workflows/release-rc.yml b/.github/workflows/release-rc.yml new file mode 100644 index 000000000..8d21b267a --- /dev/null +++ b/.github/workflows/release-rc.yml @@ -0,0 +1,74 @@ +name: Schedule RC Release + +on: + workflow_dispatch: + schedule: + # Why: GitHub cron uses UTC, not America/Los_Angeles. We trigger at both the + # PST and PDT candidate UTC hours, then gate on the actual PT wall clock so + # RC releases still happen at 4:00 AM and 3:00 PM PT year-round. + - cron: '0 11,12,22,23 * * *' + +permissions: + contents: write + +concurrency: + group: release-rc + cancel-in-progress: false + +jobs: + create-rc-tag: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Decide whether this schedule should run + id: schedule + env: + EVENT_NAME: ${{ github.event_name }} + run: | + if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then + echo "should_run=true" >>"$GITHUB_OUTPUT" + echo "pt_time=manual" >>"$GITHUB_OUTPUT" + exit 0 + fi + + pt_time=$(TZ=America/Los_Angeles date '+%H:%M') + if [[ "$pt_time" != "04:00" && "$pt_time" != "15:00" ]]; then + echo "Current PT time is $pt_time; skipping." + echo "should_run=false" >>"$GITHUB_OUTPUT" + exit 0 + fi + + echo "should_run=true" >>"$GITHUB_OUTPUT" + echo "pt_time=$pt_time" >>"$GITHUB_OUTPUT" + + - name: Checkout + if: steps.schedule.outputs.should_run == 'true' + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 0 + + - name: Setup Node.js + if: steps.schedule.outputs.should_run == 'true' + uses: actions/setup-node@v4 + with: + node-version: 24 + + - name: Configure git author + if: steps.schedule.outputs.should_run == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Sync with latest main + if: steps.schedule.outputs.should_run == 'true' + run: git pull --ff-only origin main + + - name: Create and push RC tag + if: steps.schedule.outputs.should_run == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npm version prerelease --preid=rc + git push origin main --follow-tags