-
Notifications
You must be signed in to change notification settings - Fork 13
Releasing React Magma
Laura Silva edited this page Jul 22, 2022
·
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
. ⭐ - Resolve merge conflicts, if any.
- 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. - After team approval and green build, merge the pull request
- When this gets merged, the automation will automatically merge main back into dev so the dev branch will be ready to go for future development.
- ⭐ 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 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.