┳┓┏┓┳┳┓ ┓ ┓• ┓
┃┃┃┃┃┃┃ ┏┓┓┏╋┏┓┏┓┓┏┣┓┃┓┏┣┓
┛┗┣┛┛ ┗ ┗┻┗┻┗┗┛┣┛┗┻┗┛┗┗┛┛┗
┛
A tmplr recipe to add an NPM autopublish Github action. The action will automatically publish to NPM when there is a version bump (in package.json
), pushed to the main branch.
👉 Use it on your project:
npx tmplr use trpcs/npm-autopublish
👉 Or use it as part of some other tmplr recipe:
# .tmplr.yml
steps:
# ...
- use: trpcs/npm-autopublish
# ...
If the following arguments are provided, the recipe won't prompt the user for them:
auto_publish
: Whether to add the workflow or not. A notice should be given to user if they choose to add the workflow, as they need to add a specific environment variable. If passed, then won't ask the user.test_command
: The command to test the code before publishing. Default isnpm test
, but I'd recommend using a command that also checks coverage.lint_command
: The command to check code quality before publishing.
# .tmplr.yml
use: trcps/npm-autopublish
with:
auto_publish: yes
test_command: npm run coverage
lint_command: npm run lint
Repositories using this recipe MUST add NPM_AUTH_TOKEN
secret to allow GitHub to publish to NPM on their behalf.
👉 How to generate access tokens
👉 How to add secrets for GitHub Actions