Skip to content
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

chore: set up multi-branch automated release #3110

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mweberxyz
Copy link
Contributor

@mweberxyz mweberxyz commented Apr 13, 2024

Closes #3103

This relates to...

Rationale

An issue was identified in the automatic release logic, where the changelog generation did not take multiple live release branches and major versions into account.

In fixing, automated release of both 6.x from main and 5.x from v5.x is implemented, but will require two changes: this PR to main, and a corresponding change to v5.x.

Changes

  • the Create Release PR workflow should always be run from main. A new input is required to say which release branch (currently main and v5.x) should the release be created for. The major and specific versions inputs have been removed, because a major version bump will necessitate changes to the release script and release workflow.
    • Read: whenever 7.0.0-alpha.1 comes around, ping me to update workflow to support major version bump and configuration across the three branches 😄
    • In case a non-linear version bump is needed, push the package.json version bump (either directly, or via PR) to main or v5.x and the release automation will run
  • a given branch that deploys to a particular major version should have scripts/release.js file with two variables set in header of script: VERSION_TAG_PREFIX and BRANCH (implemented in this PR for main, and the corresponding for v5.x)
  • getLatestRelease logic in scripts/release.js paginated and updated to only find the latest release for the given major version
  • latest npm tag is explicitly being set in main releases

Demo

Create PR as a sample change and merge, then run create release PR workflow, merge PR, and observe releases
Note: both sample changes target package.json, neither triggered a release

6.x.x 5.x.x
Sample change mweberxyz#30 mweberxyz#31
Skipped release workflow https://github.com/mweberxyz/nodejs-undici/actions/runs/8673906497 https://github.com/mweberxyz/nodejs-undici/actions/runs/8673905602
Create release PR CleanShot 2024-04-13 at 09 31 58@2x CleanShot 2024-04-13 at 09 36 29@2x
https://github.com/mweberxyz/nodejs-undici/actions/runs/8673918032 https://github.com/mweberxyz/nodejs-undici/actions/runs/8673940346
PR mweberxyz#32 mweberxyz#33
https://github.com/mweberxyz/nodejs-undici/actions/runs/8673947634 https://github.com/mweberxyz/nodejs-undici/actions/runs/8673952207

NPM versions after demo runs: https://www.npmjs.com/package/@mweberxyz/undici?activeTab=versions
GitHub releases after demo runs: https://github.com/mweberxyz/nodejs-undici/releases

Status

@mweberxyz mweberxyz mentioned this pull request Apr 13, 2024
3 tasks
@codecov-commenter
Copy link

codecov-commenter commented Apr 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.06%. Comparing base (ec74bf7) to head (c1b2ebf).
Report is 347 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3110      +/-   ##
==========================================
+ Coverage   94.04%   94.06%   +0.01%     
==========================================
  Files          89       89              
  Lines       24333    24327       -6     
==========================================
- Hits        22885    22883       -2     
+ Misses       1448     1444       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These scripts are becoming incredibly complex. Can you add some tests for them with mocks?

}

throw new Error(`Could not find latest release of ${VERSION_TAG_PREFIX}x`)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work when we cut v7. we should really use semver here instead of relying on filters.

@mweberxyz
Copy link
Contributor Author

Yeah, I am not necessarily happy with the implementation, but wanted to get something up as fast as possible, knowing there's a ticking time bomb where a 6.x release following a 5.x release will cause corrupted release notes.

To give myself more time for a cleaner solution, I'll get a PR up with just a fix for that particular issue.

@mweberxyz mweberxyz marked this pull request as draft April 22, 2024 16:33
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.

automate releases (v5)
3 participants