-
Notifications
You must be signed in to change notification settings - Fork 13
Releasing React Magma
Laura Silva edited this page Jun 20, 2024
·
18 revisions
react-magma uses @changesets/cli
for versioning and publishing.
We have 2 Publish Workflows: publish-next.yml and publish-latest.yml
- Triggers when changes are pushed to the
dev
branch - This release a pre-release version, builds the dev storybook (https://storybook-preview-dev--upbeat-sinoussi-f675aa.netlify.app/) and updates the docs site (https://next--upbeat-sinoussi-f675aa.netlify.app/)
- Triggers when changes are pushed to the
main
branch - This releases a new version, depending on what changes are in the changeset (could be major, minor or patch version *️⃣).
Our publish-latest
job runs the following commands:
npm run version:exit
npm run version:pkgs
git commit -am "chore: exit prerelease mode"
npm run release
git push --follow-tags
This assumes that the pre
mode has already been entered (npm run version:prerelease)
npm run version:exit updates the pre.json
file to exit mode.
npm run version:pkgs updates the changelog for all packages with the changeset updates, then deletes the changeset files. It also updates the package versions in the package.json files.
npm run release calls changeset publish
releases to npm.
- Open a pull request to merge your change from
dev -> main
. ⭐
git checkout main
git pull
git checkout -b "build/releaseX.X.X"
-
git pull origin dev
(orgit merge dev
)
- Resolve merge conflicts, if any. Run the unit tests to make sure they all pass.
- Ensure you have entered
pre
mode. If not, run the commandnpm run version:prerelease
and push that change to thepre.json
file to your branch. - Clean up the CHANGELOG by removing all the entries of the patch versions. The CHANGELOG will be recreated on publish.
- After team approval and green build, merge the pull request.
- When this gets merged, the automation will automatically merge main back into dev (Sync main -> dev step) so the dev branch will be ready to go for future development. Occasionally, this step fails. Look below at 🔀 for details on how to fix it.
- After the release is complete, make an announcement in the #react-magma chat
- First, ensure that
patch-* -> dev-patc
h branches are in sync (whether automatically or manually after the release). Then, ensure that all commits indev
are also indev-patch
. If not, start by opening a PR indev-patch
that cherry-picks every commit fromdev
that should be part of this release. Note that any commits that update the package-lock may cause issues. - Open a pull request to merge your change from
dev-patch -> patch-3.x.x
. ⭐
git checkout patch-3.x.x
git pull
git checkout -b "build/releaseX.X.X"
-
git pull origin dev-patch
(orgit merge dev-patch
)
- Resolve merge conflicts. There will be some in the package.json files and changelog. Clean up the CHANGELOG by removing all the entries of the patch versions. Run the unit tests to make sure they all pass.
- The version in the react-magma-dom package.json should be of the last released version. The pipeline process will up this version (depending on the changes, will release a major/minor/patch).
- Ensure you have entered
pre
mode. If not, run the commandnpm run version:prerelease
and push that change to thepre.json
file to your branch. The react-magma-dom version in this file should also have the last released version.
- ⭐ Make sure you don't accidentally push a change to
main
before you intended to (for example, while fixing merge conflicts). ALL pushes tomain
will trigger the publish job and can lead to unwanted releases - To confirm what version is going to be released, you can locally run the Publish commands (without pushing it to the branch). The package.json files will get updated with
npm run version:pkgs
and you'll be able to see the version number you are publishing along with the updated dependencies. - 🔀 If the
Sync main -> dev
step fails, fix it manually by creating a new branch fromdev
, thengit pull origin main
. Fix the merge conflicts by doing the following:- Remove all the
.md
changeset files from the.changeset
directory - For the
package.json
files, resolve the conflicts with what is coming from main. Ultimately, we don't want the prerelease versions. Update something that looks like"version": "1.0.2-next.0"
to be"version": "1.0.2"
. - For the
Changelogs
, make sure the logs look right and are up to date for the appropriate versions. - Example PR
- Remove all the
- *️⃣ If your changeset has different kinds of changes, the version for release will be flattened to the highest semver range:
Changesets are designed to be as easy to accumulate as possible. As such, when changesets are consumed with version, we flatten the version bumps into one single bump at the highest semver range specified.
For example: if you run version, and we have packageA at 1.1.1, which has two minor changesets, and one patch changeset, we will bump packageA to 1.2.1.