If you would like to read about how this toolkit was made, start with this blog post.
-
version: Upgrades package version using--patch,--minor, or--major -
changelog: Updates or creates CHANGELOG.md (requiresversionrun first). Will prompt for type of change and description unless--typeand/or--messageargs are used. Allowed types:FeatureBug fixChoreBreaking change
-
release: Runsversionandchangelog -
verify: Verifies package version and CHANGELOG.md have both been updated -
publish: Uses current version to publish tonpmand create a GitHub release by default, either can be skipped with--no-npmor--no-githubflags.
relase-toolkit is designed to be used in GitHub workflows.
Example GitHub repo
Here's an example library. This example uses branch protection rules which:
- Prevent code being pushed directly to the
mainbranch - Prevent branches from being merged until they have passing pipelines
You might also want to enable Require pull request reviews depending on your setup.
Example workflow pipelines
These pipeline configs live in the .github/workflows directory. When all pipelines
have passed and the branch is merged into main, the new version of the library is
automatically published to npm and a GitHub release is created.
verify.yml runs every time code is pushed to any branch other than main,
making sure version and changelog have been updated, and verifies that the build
and unit tests pass. If any of these fail, the branch won't merge to main.
on:
push:
branches-ignore:
- main
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npx helloitsjoe/release-toolkit verify
- run: yarn
- run: yarn test
- run: yarn buildrelease.yml runs every time a branch is merged to main. At that point all verification
and tests have passed, so it automatically publishes to npm and creates a GitHub release.
For authentication, it uses environment variables set in the GitHub repo's secrets section.
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn build
- run: npx helloitsjoe/release-toolkit publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}