Skip to content

Github-Actions-Community/merge-release

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

LogoMakr-2ULBLV

All Contributors

GitHub Action for automated npm publishing.

This Action publishes a package to npm. It is meant to be used on every successful merge to main but you'll need to configure that workflow yourself. You can look to the .github/workflows/push.yml file in this project as an example.

Workflow

  • Check for the latest version number published to npm.
  • Lookup all commits between the git commit that triggered the action and the latest publish.
    • If the package hasn't been published or the prior publish does not include a git hash, we'll only pull the commit data that triggered the action.
  • Based on the commit messages, increment the version from the lastest release.
    • If the strings "BREAKING CHANGE" or "!:" are found anywhere in any of the commit messages or descriptions the major version will be incremented.
    • If a commit message begins with the string "feat" then the minor version will be increased. This works for most common commit metadata for feature additions: "feat: new API" and "feature: new API".
    • All other changes will increment the patch version.
  • Publish to npm using the configured token.
  • Push a tag for the new version to GitHub.

Configuration

You can configure some aspects of merge-release action by passing some environmental variables.

  • GITHUB_TOKEN (required)
    • Github token to allow tagging the version.
  • NPM_AUTH_TOKEN (required)
    • NPM Auth Token to publish to NPM, read here how to setup it as a secret.
  • DEPLOY_DIR
    • The path where the dist package.json is to run npm publish. Defaults to the root dir.
  • SRC_PACKAGE_DIR
    • The path where the src package.json is found. Defaults to the root dir.
  • NPM_REGISTRY_URL
    • NPM Registry URL to use. defaults to: https://registry.npmjs.org/
  • NPM_PRIVATE
    • If you wish privately publish your package please ensure you have set this to true

merge-release will use npm publish unless you've defined a publish script in your package.json.

- uses: Github-Actions-Community/merge-release@main
  env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
      DEPLOY_DIR: my/deploy/dir
      SRC_PACKAGE_DIR: my/src/package

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Mikeal Rogers
Mikeal Rogers

💻
Alex Potsides
Alex Potsides

📖
Alvaro Jose
Alvaro Jose

💻
Jonjoe Whitfield
Jonjoe Whitfield

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Created my free logo at LogoMakr.com

About

Automatically release all merges to master on npm.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 62.9%
  • Shell 25.6%
  • Dockerfile 11.5%