Replies: 3 comments 1 reply
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
-
The project and this RFC can now be considered "complete". The tracking issue at #22532 still has minor outstanding improvements, but overall the RFC is complete. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Status: accepted
Tracked in: #22532
Summary
This is a proposal to revamp the way we do and handle releases in the Storybook monorepo. This doesn’t have an affect on the regular Storybook user, it only affects maintainers and contributors to the Storybook core monorepo.
Problem Statement
Non-goals
Ideas have been floating around about how packages are versioned collectively and independently. That is not a goal in this project proposal. This project should maintain the current versioning strategy (except for canaries).
This proposal also doesn’t concern any of the Storybook satellite repositories, only the monorepo. If this is successful we could consider streamlining the workflow and implementing it in the satellite repos, but that is for another project.
Scheduling and the cadence of releases are also not part of this proposal. However this proposal is about getting the tooling right, so whatever tooling solution we land on, it should support changing our release process/schedule/cadence later down the road without too much work needed.
High level process
There are five types of releases that will be handled somewhat differently, but following the overall same principles. It will be based on automatically created and updated PRs, that can also be triggered manually.
Prereleases -
7.1.0-alpha.12
->7.1.0-alpha.13
These happen multiple times a week
version-from-7.1.0-alpha.16
tonext-release
on every push tonext
. If the PR is already open, it will be kept up-to-date with description changes and force pushing commits. This process can also be manually triggered if needed.package.json
s and other files likeversions.ts
CHANGELOG.md
generated as specced belownext-release
next-release
back tonext
. If this causes a merge conflict, this will have to be done manuallyPrerelease promotions -
7.1.0-alpha.13
->7.1.0-beta.0
These happen once every 1-2 months
Same process as above, except before merging, the Releaser manually triggers the Action with a "tag: beta" input, that will change versions from the proposed
7.1.0-alpha.14
to7.1.0-beta.0
.Minor/major releases -
7.1.0-rc.2
->7.1.0
These happen once every quarter
Same process as above, except before merging, the Releaser manually triggers the Action with a "tag: stable" input, that will change versions from the proposed
7.1.0-rc.3
to7.1.0
. When the PR is merged, the action will do the usual publishing work, and force mergenext
intomain
. The following GitHub Action that triggers on a push tonext
will generate a release PR with7.2.0-alpha.0
, to start the cycle over.Patch releases to stable - subset of
7.1.0-alpha.13
->7.0.14
These happen roughly every second week
This process is a bit different from the above because it needs to merge to the
main
branch and notnext
, but the principle is the same.next
that needs to be patched back to stable, needs to have a "patch" labelnext
, an action check for any such PRs with the "patch" labelversion-from-7.0.11
) and PR similar to the one for prereleases, except that it targetsmain
.version-from-7.0.11
branchWhen the PR has been merged to
main-release
by the Releaser, after the usual publishing steps, the action will also label all patched PRs with "picked" so they are ignored for the next patch release.Patch releases to earlier versions - subset of
7.1.0-alpha.13
->6.5.14
These happen 2-3 times a year
Given that this happens so rarely on a case by case basis, I'm okay with this being a completely manual process. The only thing we then need to keep in mind, is that all these versioning and publishing scripts needs to be executable locally, outside of a GitHub Action.
Changelog format
A GitHub release will have the same content as the changelog entry
The changelog will be split into a
CHANGELOG.md
andCHANGELOG.prerelease.md
, along with the existingCHANGELOG.v6.md
we have to day. This split makes it easy for users to see what has changed between 7.0.6 and 7.0.10 without having to sift through 15x 7.1.0 alpha releases. It's also easier to implement, as it allows us to just put new entries at the top, not worrying about trying to insert entries in the right order.Low level implementation plan
It's important that this whole process can be done manually, locally as well, if for some reason we need an extra level of control. The automated GitHub Actions will be thin wrappers around those scripts, that also takes care of branches, committing and pushing, something you don't want to happen locally.
Scripts
check-release-needed.ts
version.ts
write-changelog.ts
generate-pr-description.ts
pick-patches.ts
publish.ts
Action: Create Prerelease PR
This action will create and keep a release branch+PR up-to-date.
next
and manualworkflow_dispatch
: tag (alpha, beta, rc, stable)check-release-needed.ts
,verson.ts
,write-changelog.ts
version-from-7.1.0-alpha.16
branch and force pushnext-release
, withgenerate-pr-description.ts
Action: Create Patch Release PR
next
and manualcheck-release-needed.ts
,verson.ts
,write-changelog.ts
,pick-patches.ts
version-from-7.0.10
branch and force pushmain
, withgenerate-pr-description.ts
Action: Publish new prereleases
next-release
publish.ts
if applicablenext-release
tonext
7.1.0-rc.2
->7.1.0
), mergenext
tomain
Action: Publish patch releases
main-release
publish.ts
if applicablemain-release
tomain
Deliverables
See task list in tracking issue #22532
Initial attempt - with Changesets. Cancelled
Here for historical reasons
Tracking Issue: #22242
The proposal here is to rely on the Changesets package - a very popular OSS tool to manage package releases, especially in monorepo setups.
While Changesets can do a lot of things, here’s a very quick summary of the moving parts and how the workflow would be for maintainers and contributors.
yarn changesets
which prompts the user to specify changed packages, version bumps and a changelog summary. This creates a special file that is committed.next
ormain
.Here’s a YouTube video quickly explaining most of a Changesets workflow:
https://youtu.be/eh89VE3Mk5g?t=84
Prior Art
Changesets is used by many of the other teams in the ecosystem:
Deliverables
main
release branch and anext
prerelease branch.next
.next
and hopefully see the "Version Packages" PR7.1.0-alpha
version release.Risks
next
/main
. This means that anyone with permission to merge to those branches can trigger a release. We want to ensure that only members of the core team can perform those merges.Unresolved Questions
main
ifnext
is already on a prerelease of the upcoming version? Say a PR tonext
(which is at7.1.0-alpha.8
) fixes a bug, and we want to release that bug as well to7.0.9
, how do we do that?alpha
,beta
,rc
?Alternatives considered / Abandoned Ideas
Keep the existing workflow. The problem statement of this proposal should describe why this is not recommended.
Make the current release tool usable by the whole core team. This would still fix some of the problems around the bus factor and spread out the responsibility of releasing to the rest of the team. But not using a tool battle-tested by the rest of the ecosystem would still mean that we have a higher maintenance burden. It would also require more effort to get a great experience (eg. using an existing GitHub bot that provides a good experience vs. building our own GitHub bot from scratch). Using a popular tool used by other similar projects also indicates that the tool gets new features more frequently, which we could potentially leverage without much effort.
Use Auto instead of Changesets. Auto is another automated packaging/releasing tool that is familiar to the Storybook team, and is used in quite a few of the satellite repos. But its support of publishing multiple packages in a monorepos is reliant on Lerna, a tool now semi-deprecated that we don’t really utilize.
Beta Was this translation helpful? Give feedback.
All reactions