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

ci: add release action and scripts #36

Merged
merged 3 commits into from
Sep 1, 2022
Merged

ci: add release action and scripts #36

merged 3 commits into from
Sep 1, 2022

Conversation

devisscher
Copy link
Contributor

@devisscher devisscher commented Sep 1, 2022

This PR adds a GH action which watches merges to the main branch. It creates a new version when changesets are detected and bumps the version accordingly.

Typical flow:

Feature work

  1. Changes are made in a working branch and it is deemed that a version (patch/minor/major) bump is needed.
  2. On the working branch run yarn changeset and completes the prompts.
  3. Then push the generated changesets to your working branch.
  4. Merge working branch as you would normally, after getting reviews and CI passes.

New version and releasing

  1. When feature work is merged into main there is a release GitHub action which will run.
  2. It runs yarn version and incorporates the changesets into the changelog.
  3. It bumps the version accordingly. If changesets contain minor changes then the minor version is bumped.
  4. The release action runs yarn release, which runs the tag command because we are using a different tool (Shipit), to publish our package. It creates a vX.X.X tag, which can then be picked up by Shipit.

The tag command creates git tags for the current version of all packages. The tags created are equivalent to those created by changeset publish, but the tag command does not publish anything to npm.

This is helpful in situations where a different tool, such as pnpm publish -r, is used to publish packages instead of changeset. For situations where changeset publish is executed, running changeset tag is not needed.

The git tags in monorepos are created in the format pkg-name@version-number and are based on the current version number of the package.json for each package. Note that in single-package repositories, the git tag will include v before the version number, for example, v1.0.0. It is expected that changeset version is run before changeset tag, so the package.json versions are updated before the git tags are created.

Safety check: when running without any version bumps:

image

@devisscher devisscher marked this pull request as ready for review September 1, 2022 13:36
@devisscher devisscher requested a review from a team September 1, 2022 13:36
Copy link
Contributor

@carrotderek carrotderek left a comment

Choose a reason for hiding this comment

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

👍🏼

@devisscher devisscher merged commit c985f92 into main Sep 1, 2022
@devisscher devisscher deleted the gh-action-release branch September 1, 2022 15:40
@devisscher
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants