GitHub Action
npm-semver-publish
Follow me, and consider starring the project to show your ❤️ and support.
This action allow your project to create a new release, based on semantic versionig principles, and publish it to your npm registry.
To generate a new version (git tag and npm package publishing), you have just to add to the commit message one of the following key:
- [MAJOR] or [major]: new major release, e.g. v1.0.0 -> v2.0.0 will be
executed
git commit -m "add best feature ever [major]"
- [PATCH] or [patch]: new patch release, e.g. v1.0.0 -> v1.0.1 will be
executed
git commit -m "fix best feature ever [patch]"
- without any of the above keywords a new minor release will be executed, e.g.
v1.0.0 -> v1.1.0
git commit -m "update best feature ever"
An new release is only exeuted on the defined target-branch (see Action Usage)
See action.yml
Name | Type | Default | Description |
---|---|---|---|
target-branch | string | master | Branch name new release should be executed |
provenance | string | false | NPM package provenance |
❗ When the Action Parameter provenance is set to true the id-token permission must be set to write:
permissions:
id-token: write
on:
push:
branches: master #the branch name must be the same of **target-branch**
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write #allow to push on git repo
id-token: write #allow to publish npm package
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4 #checkout git repo
uses: actions/setup-node@v4 #setup node env
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- name: Run my Action
id: run-action
uses: iuccio/[email protected] #execute npm semver publish
with:
target-branch: master
provenance: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} #npm token
This action requires the NPM_TOKEN secret configuretion:
- generate a new npm token able to publish Creating and viewing access tokens
- add the above generated token in the secret NPM_TOKEN (see Using secrets in GitHub Actions)
Add permissions to to push on git and publish on npm
permissions:
contents: write
id-token: write
Add to the checkout action:
uses: actions/checkout@v4
Add an actions/setup-node step to your workflow. If you have one already, ensure that the registry-url input is set (e.g. to https://registry.npmjs.org) so that this action can populate your .npmrc with authentication info:
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
add actions/npm-semver-publish step:
name: Run my Action
id: run-action
uses: iuccio/[email protected]
with:
target-branch: 'master' #where a new release is applied
provenance: true #if you want to publish on npm registry the provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
That's it!
See Development for more information.
CSVtoJSON is licensed under the GNU General Public License v3.0 License.
Just if you want to support this repository:
- BTC tip address: 37vdjQhbaR7k7XzhMKWzMcnqUxfw1njBNk