-
Notifications
You must be signed in to change notification settings - Fork 693
Update CI flow so that we bump from beta to main, and sync back #614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add safeguards to prevent concurrent releases and ensure beta stays in sync: - Add concurrency group to prevent overlapping release runs - Enforce workflow runs only on main branch (fail if run elsewhere) - Explicitly checkout and push to main (not dynamic branch) - Fail if release tag already exists (was silently skipping) - Add sync_beta job that merges main back into beta after release - Add docs/guides/RELEASING.md with two
For release notes to work we need for PRs from beta to main to not be squashed. We also want to enforce all changes to be via PRs, for humans. But that also limits GH Actions. An alternative is creating a GH App with bypass permissions but that felt like overkill Replace direct pushes to main/beta with PR-based workflow for better branch protection compatibility: - Create temporary release/vX.Y.Z branch for version bump - Open PR from release branch into main, enable auto-merge - Poll for PR merge completion (up to 2 minutes) before creating tag - Fetch merged main and create tag on merged commit - Clean up release branch after tag creation - Create PR to merge main into beta (skip if already
📝 WalkthroughWalkthroughRestructures the release workflow to implement PR-based version bumping with a temporary release branch, adds a beta sync job to merge main back to beta, and introduces GitHub release creation automation with auto-merge support for bump PRs. Includes comprehensive release documentation for maintainers. Changes
Sequence DiagramsequenceDiagram
actor User
participant GitHub as GitHub<br/>(Workflow)
participant Git as Git Repo
participant PR as PR System
participant Release as Release Job
User->>GitHub: Trigger release workflow on main
GitHub->>Git: Checkout main branch
GitHub->>Git: Commit version bump to release/v* branch
GitHub->>Git: Push release branch
GitHub->>PR: Create version bump PR (release/* → main)
GitHub->>PR: Enable auto-merge on PR
PR->>PR: Poll PR merge status
PR->>Git: Merge bump PR into main
GitHub->>Git: Fetch merged main
GitHub->>Git: Create & push version tag
Release->>GitHub: Create GitHub Release
GitHub->>PR: Create sync PR (main → beta)
PR->>Git: Merge sync PR if not up-to-date
GitHub->>Git: Delete release branch cleanup
GitHub->>User: Release complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@dsarno @Scriptwonder - I'll merge this to main now so our CI should work in the next release. New flow since we now merge to
It could be simpler but branch rules also limit with GitHub actions can do |
Reviewer's GuideRefactors the release GitHub Actions workflow to run only from main, create a temporary release branch and PR for version bumps, tag and release from the merged main commit, then sync main back into beta via PR, and documents the new two-branch release process for maintainers. Sequence diagram for new release workflow from main with beta syncsequenceDiagram
actor Maintainer
participant ActionsRelease as Actions_release_workflow
participant JobBump as Job_bump
participant JobSync as Job_sync_beta
participant Main as Branch_main
participant Beta as Branch_beta
participant RelBranch as Branch_release_vX_Y_Z
participant BumpPR as PR_release_vX_Y_Z_to_main
participant SyncPR as PR_main_to_beta
participant Tags as Git_tags
participant GHRelease as GitHub_Release
Maintainer->>ActionsRelease: Run workflow on main with bump_type
ActionsRelease->>JobBump: Start bump job
JobBump->>JobBump: Ensure ref is main
JobBump->>Main: Checkout main
JobBump->>JobBump: Compute new_version and tag
JobBump->>RelBranch: Create branch release_vX_Y_Z from main
JobBump->>RelBranch: Commit version bump
JobBump->>RelBranch: Push release_vX_Y_Z to origin
JobBump->>BumpPR: Create PR base main head release_vX_Y_Z
JobBump->>BumpPR: Enable auto-merge and wait for merge
BumpPR->>Main: Merge release_vX_Y_Z into main
JobBump->>Main: Fetch and pull merged main
JobBump->>Tags: Create annotated tag vX_Y_Z on main commit
JobBump->>Tags: Push tag to origin
JobBump->>GHRelease: Create GitHub Release for tag
JobBump->>RelBranch: Delete release_vX_Y_Z branch on origin
ActionsRelease->>JobSync: Start sync_beta job (needs bump)
JobSync->>Main: Checkout main
JobSync->>Beta: Fetch beta
JobSync->>JobSync: Check if beta is behind main
alt beta already up to date
JobSync-->>ActionsRelease: Skip sync PR
else beta behind main
JobSync->>SyncPR: Create PR base beta head main
JobSync->>SyncPR: Enable auto-merge and wait for merge
SyncPR->>Beta: Merge main into beta
end
Flow diagram for sync_beta job logicflowchart TD
A["Start sync_beta job"] --> B["Checkout main"]
B --> C["Fetch origin/beta"]
C --> D["Is origin/main ancestor of origin/beta?"]
D -->|yes| E["beta already up to date"]
E --> F["Set skipped output to true"]
F --> G["End job"]
D -->|no| H["Create PR base beta head main"]
H --> I["Store PR url and number outputs"]
I --> J["Enable auto-merge for PR"]
J --> K["Poll PR state up to 2 minutes"]
K --> L{PR merged?}
L -->|yes| M["Sync PR merged successfully"]
M --> G
L -->|no| N["Attempt direct merge of PR"]
N --> O["End job"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue, and left some high level feedback:
- The logic for enabling auto-merge and polling for PR merge completion is duplicated between the bump and sync jobs; consider extracting this into a shared script or composite action to reduce duplication and keep future changes in one place.
- In the
sync_betajob,gh pr createwill fail if amain -> betaPR already exists; it may be more robust to first check for an existing open PR between these branches and reuse/annotate it instead of unconditionally creating a new one.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The logic for enabling auto-merge and polling for PR merge completion is duplicated between the bump and sync jobs; consider extracting this into a shared script or composite action to reduce duplication and keep future changes in one place.
- In the `sync_beta` job, `gh pr create` will fail if a `main -> beta` PR already exists; it may be more robust to first check for an existing open PR between these branches and reuse/annotate it instead of unconditionally creating a new one.
## Individual Comments
### Comment 1
<location> `.github/workflows/release.yml:180-188` </location>
<code_context>
git tag -a "$TAG" -m "Version ${TAG#v}"
git push origin "$TAG"
+ - name: Clean up release branch
+ if: always()
+ env:
+ GH_TOKEN: ${{ github.token }}
+ BRANCH: ${{ steps.bump_branch.outputs.name }}
+ shell: bash
+ run: |
+ set -euo pipefail
+ git push origin --delete "$BRANCH" || true
+
- name: Create GitHub release
</code_context>
<issue_to_address>
**issue (bug_risk):** The release branch is deleted unconditionally, even if the bump PR fails to merge.
Because this step uses `if: always()`, it deletes the remote release branch even when `gh pr merge` fails (e.g., due to reviews, checks, or branch protection). That leaves an open PR whose source branch has been deleted, making recovery manual and error-prone.
Please gate this cleanup on the PR actually being merged (or otherwise in a terminal state), e.g. by checking `gh pr view` or wiring this step to depend on the merge step’s outcome/output before deleting the branch.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| - name: Clean up release branch | ||
| if: always() | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| BRANCH: ${{ steps.bump_branch.outputs.name }} | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| git push origin --delete "$BRANCH" || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): The release branch is deleted unconditionally, even if the bump PR fails to merge.
Because this step uses if: always(), it deletes the remote release branch even when gh pr merge fails (e.g., due to reviews, checks, or branch protection). That leaves an open PR whose source branch has been deleted, making recovery manual and error-prone.
Please gate this cleanup on the PR actually being merged (or otherwise in a terminal state), e.g. by checking gh pr view or wiring this step to depend on the merge step’s outcome/output before deleting the branch.
Description
We now create releases after merging
betabranch tomain.Type of Change
Changes Made
Adjust CI because we now merge to
betainstead ofmainTesting/Screenshots/Recordings
N/A
Documentation Updates
tools/UPDATE_DOCS_PROMPT.md(recommended)tools/UPDATE_DOCS.mdAdded releasing guidelines
Related Issues
N/A
Additional Notes
N/A
Summary by Sourcery
Update the release workflow to bump versions and tag releases from main via temporary PRs, then automatically sync main back into beta, and document the new releasing process.
CI:
Documentation:
Summary by CodeRabbit
Chores
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.