- uses: mikeal/merge-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
DEPLOY_DIR: my/deploy/dir
SRC_PACKAGE_DIR: my/src/package
merge-release
Automatically release all merges to master on npm.
How to Use Merge Release GitHub Action
Merge Release action does the following critical stuff to help publish automatically npm. Check the version number of the last published on npm and the commits between the git commit that triggered this action and the latest published. It then bumps the package's version according to the messages of these commits: a major version if a commit contains "BREAKING CHANGE," a minor for any commit containing "feat," or a patch for everything else. Finally, it publishes the npm package and pushes the tag for the new version up to Github.
Excellent features of this action include: automatic npm publishing based on commit messages, following the principles of semantic versioning, and making integration with GitHub Actions a lot easier.
How to Use
-
Setup GitHub Secrets: Make sure you have
GITHUB_TOKEN
andNPM_AUTH_TOKEN
as secrets in your GitHub repository. -
Create Workflow File: Create a Workflow file (example:
publish.yml
in the.github/workflows
directory with the below configuration) -
Commit and Push: Commit and push the Workflow file to Repository. After that, your action will run on every push to the main or main branch, automatically publishing a new version to npm.
-
Monitor Releases: In the Actions tab at the top of your GitHub repository, watch the workflow runs, affirming new versions are published as expected.
At this point, it should all be automated within your projects, so releasing a new version should be a smooth and error-free.