Skip to content

Releasing React Magma

Laura Silva edited this page Jul 22, 2022 · 18 revisions

react-magma uses @changesets/cli for versioning and publishing.

Github Workflows Publish Job

We have 2 Publish Workflows: publish-next.yml and publish-latest.yml

Next

Latest

  • 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.

Steps to release

  1. Open a pull request to merge your change from dev -> main. ⭐
  2. Resolve merge conflicts, if any.
  3. Ensure you have entered pre mode. If not, run the command npm run version:prerelease and push that change to the pre.json file to your branch.
  4. After team approval and green build, merge the pull request
  5. 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.

Gotchas

  • ⭐ Make sure you don't accidentally push a change to main before you intended to (for example, while fixing merge conflicts). ALL pushes to main 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.
Clone this wiki locally