Daily Release PR #293
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Daily Release PR | |
| on: | |
| schedule: | |
| - cron: "30 12 * * *" # 4:30 AM PT | |
| - cron: "0 3 * * *" # 7:00 PM PT | |
| workflow_dispatch: | |
| concurrency: | |
| group: release-pr | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| actions: write | |
| env: | |
| NODE_VERSION: "24" | |
| BUN_VERSION: "1.2.21" | |
| jobs: | |
| open-release-pr: | |
| name: Open draft release PR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Check for changes since last release | |
| id: release_changes | |
| run: | | |
| last_tag=$(git describe --tags --match "v[0-9]*" --abbrev=0 2>/dev/null || echo "") | |
| if [ -z "$last_tag" ]; then | |
| echo "No release tags found. Proceeding with release." >> "$GITHUB_STEP_SUMMARY" | |
| echo "proceed=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if git diff --quiet "$last_tag"..HEAD; then | |
| echo "No changes since last release ($last_tag)." >> "$GITHUB_STEP_SUMMARY" | |
| echo "proceed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Changes detected since last release ($last_tag)." >> "$GITHUB_STEP_SUMMARY" | |
| echo "proceed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Setup Node.js | |
| if: steps.release_changes.outputs.proceed == 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup Bun | |
| if: steps.release_changes.outputs.proceed == 'true' | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: ${{ env.BUN_VERSION }} | |
| - name: Install dependencies (bun) | |
| if: steps.release_changes.outputs.proceed == 'true' | |
| run: bun install --frozen-lockfile | |
| - name: Configure git user | |
| if: steps.release_changes.outputs.proceed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Create draft release PR | |
| id: create_release_pr | |
| if: steps.release_changes.outputs.proceed == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| RELEASE_BASE_BRANCH: ${{ github.event.repository.default_branch }} | |
| run: bun ./scripts/release-pr.ts | |
| - name: Trigger electron build workflow | |
| if: steps.release_changes.outputs.proceed == 'true' && steps.create_release_pr.outputs.release_pr_state == 'created' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const branch = '${{ steps.create_release_pr.outputs.release_branch }}'; | |
| if (!branch) { | |
| core.setFailed('Release branch output missing; cannot dispatch electron build workflow.'); | |
| return; | |
| } | |
| const workflowId = 'release-updates.yml'; | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: workflowId, | |
| ref: branch, | |
| }); | |
| core.info(`Triggered ${workflowId} on ${branch}`); | |
| - name: Skip release (no changes) | |
| if: steps.release_changes.outputs.proceed == 'false' | |
| run: echo "Skipping release because no changes were detected since the last tag." |