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

Improve release script #84

Merged
merged 3 commits into from
Jun 27, 2024
Merged

Improve release script #84

merged 3 commits into from
Jun 27, 2024

Conversation

roluk
Copy link
Member

@roluk roluk commented Jun 21, 2024

  • Update release script
  • Move from ts-node to its modern alternative tsx

These changes do not affect our current release process. They make it easier to perform the existing package release sequence.

Do mind though that the script reports release tag name as react-v0.6.x instead of the old format v0.6.x-react. The release pipeline still expects the latter version, I just haven't made that change yet. I moved the package discriminator to suffix position so that pre-release versions of packages have cleaner tags, e.g. react-1.2.3-nightly.4.

Excerpt from release.ts

This script's purpose is to automate the process of publishing a branch containing new version of a package to the remote repository. It was written with the goal to maintain a good balance of code brevity, features, and resilience to errors.

If you had to perform the release manually, you would have to successfully execute the following steps.

  • Create a release branch or merge code into an already existing one
  • Edit CHANGELOG.md to update the release title
  • Bump "version" field in package.json
  • Commit the changes
  • Push release branch to remote repository

The steps above, except for editing the changelog, could be performed with following commands.

$ git switch -c release/1.2.x
<edit CHANGELOG.md>
$ npm version minor
$ git commit -m "Release [email protected]" package.json CHANGELOG.md
$ git push origin HEAD

That's not a lot. But to account for various (valid and invalid) local repository states, we need to perform additional checks and actions so that the desirable result is achieved more consistently and problems are detected and reported preemptively.

When extending this script, please maintain a couple of core design guidelines.

  • Seek confirmation from the user before making changes to existing repository state. Changes in branches that this script has just created are exempt because there's no chance of messing up user's repository.
  • Report all observable repository state changes (file writes, commits, branch operations, etc.)
  • Use throw new RuntimeError(message) to report error and terminate script with non-zero status code

scripts/release.ts Outdated Show resolved Hide resolved
@roluk roluk merged commit 1de46cf into master Jun 27, 2024
4 checks passed
@roluk roluk deleted the release-script branch June 27, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants