Skip to content

ci: Sync dev with main after each release - #674

Merged
edwardtfn merged 1 commit into
devfrom
ci/sync-dev-after-release
Nov 5, 2026
Merged

edwardtfn merged 1 commit into
devfrom
ci/sync-dev-after-release

Conversation

@panel-easy-assistant

@panel-easy-assistant panel-easy-assistant Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

After each release, the versioning workflow pushes the version bump and the pre-built firmware commits to main, leaving dev behind main until it is synced manually. This causes the next release PR to show as behind, and can create conflicts in the files the workflow rewrites (for example a new next sentinel on dev against the version already resolved on main).

This adds a sync-dev job to versioning.yml that runs after the release is published, in parallel with the Discord announcement, so a failure in it never blocks or delays the announcement:

  • If dev does not exist, it is created from the released main.
  • If dev has nothing beyond the released main (the normal case), it is fast-forwarded.
  • If dev received commits during the release window, main is merged into it with a merge commit. A conflict fails the job and is left for manual resolution.
  • dev is never force-pushed: if it moves while the job runs, the push is rejected instead of overwriting it.

commit-and-release now exposes the final released SHA (after the pre-built firmware commit) as an output for this job.

Note: pushes made with GITHUB_TOKEN do not trigger other workflows, so CI does not run on the updated dev. For a fast-forward the content is exactly what was released; in the merge case, the merge commit is validated by the next PR.

Summary by Sourcery

Automatically synchronize dev with the final released main branch without delaying release announcements.

New Features:

  • Automatically synchronize the dev branch with the released main branch after each successful release, creating it when absent and safely fast-forwarding or merging as needed.

Bug Fixes:

  • Keep dev aligned with the final released commit to prevent subsequent release changes from starting behind main.

Enhancements:

  • Expose the final released commit SHA for downstream workflow jobs and run dev synchronization independently of release announcements.

CI:

  • Add a post-release sync-dev job with concurrency control and non-force-pushing behavior so concurrent updates or merge conflicts cannot overwrite dev.

@sourcery-ai

sourcery-ai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The release workflow now exports the final released commit SHA and uses it in an independent sync-dev job to create, fast-forward, or merge main into dev without force-pushing, while keeping Discord announcements unaffected by synchronization failures.

Flow diagram for syncing dev with released main

flowchart TD
    Start[Released main SHA available] --> Exists{dev exists?}
    Exists -->|No| Create[Create dev at release SHA]
    Exists -->|Yes| Fetch[Fetch origin/dev]
    Fetch --> Contains{dev contains release SHA?}
    Contains -->|Yes| Done[No action]
    Contains -->|No| Behind{dev is ancestor of release SHA?}
    Behind -->|Yes| FF[Fast-forward dev to release SHA]
    Behind -->|No| Merge[Merge released main into dev]
    Merge --> Conflict{Merge succeeds?}
    Conflict -->|No| Fail[Fail; manual resolution required]
    Conflict -->|Yes| Push[Plain push merge commit]
    Create --> End[Sync complete]
    Done --> End
    FF --> End
    Push --> End
    Push -.->|dev moved meanwhile| Reject[Push rejected; no overwrite]
Loading

File-Level Changes

Change Details Files
Expose the final released commit SHA from the release job for downstream branch synchronization.
  • Capture HEAD after the pre-built firmware commit.
  • Publish the SHA as a commit-and-release job output alongside release metadata.
.github/workflows/versioning.yml
Add a post-release job that safely brings dev in line with the released main commit.
  • Run only after a successful release and in parallel with Discord notification.
  • Create dev when absent, skip when it already contains the release, or fast-forward it when possible.
  • Merge the released main into divergent dev with a non-fast-forward merge commit.
  • Reject conflicts and concurrent branch movement without force-pushing.
.github/workflows/versioning.yml
Document the workflow ordering and operational behavior of the new synchronization path.
  • Update workflow comments to describe sync-dev as a parallel post-release action.
  • Note that GITHUB_TOKEN pushes do not trigger CI on updated dev.
.github/workflows/versioning.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

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

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/versioning.yml" line_range="770" />
<code_context>
   # ---------------------------------------------------------------------------
   # Announce the new release on Discord.
-  # Always runs last — only when a release was actually published.
+  # Runs after the release, in parallel with sync-dev — only when a release
+  # was actually published.
   # ---------------------------------------------------------------------------
</code_context>
<issue_to_address>
**Existing workflow comment is removed**

When the `notify-discord` header is updated, the original notification-order comment is replaced rather than retained, so the change removes an existing comment contrary to the repository guidance.

Preserve the original comment and add the new parallel-execution explanation without removing it.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. If the branch checks or merge logic are wrong, this workflow can create or advance dev and leave a merge commit there; reverting the workflow will not remove those commits. The branch history can be reset or the changes reverted, and the non-force pushes limit the damage if dev moves concurrently.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/versioning.yml Resolved
@edwardtfn
edwardtfn merged commit f3ab8ec into dev Nov 5, 2026
22 checks passed
@edwardtfn
edwardtfn deleted the ci/sync-dev-after-release branch November 5, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant