Please consider following this project’s author, Antò, and consider starring the project to show your :heart: and support.
This action allow your project to create a new release, based on semantic versionig principles, and publish it to your npm registry.
Once your repository is configured with this action, to generate a new version you have just to add to the commit message one of the following string:
git commit -m "add best feature ever [major]"git commit -m "fix best feature ever [patch]"git commit -m "update best feature ever"An new release is only exeuted on the defined target-branch (see Action Usage)
This action requires the following Secrets:
uses: actions/checkout@v4
with:
token: $
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
uses: fregante/setup-git-user@v2
name: Run my Action
id: run-action
uses: iuccio/npm-semver-publish-action@v1.0.0
with:
target-branch: 'master' #where a new release is applied
env:
NODE_AUTH_TOKEN: $
That’s it!
on:
push:
branches: main
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
with:
token: $
- uses: fregante/setup-git-user@v2
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- name: Run my Action
id: run-action
uses: iuccio/npm-semver-publish-action@v1.0.0
with:
target-branch: master
provenance: true
env:
NODE_AUTH_TOKEN: $
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
Install the dependencies
npm install
Package the JavaScript for distribution
npm run bundle
Run the tests
npm test
GitHub Actions Toolkit documentation.
src/__tests__/Format, test, and build the action
npm run all
[!WARNING]
This step is important! It will run
nccto build the final JavaScript action code with all dependencies included. If you do not run this step, your action will not work correctly when it is used in a workflow. This step also includes the--licenseoption forncc, which will create a license file for all of the production node modules used in your project.
Commit your changes
git add .
git commit -m "My first action is ready!"
Push them to your repository
git push -u origin releases/v1
main branchYou can now validate the action by referencing it in a workflow file. For
example, ci.yml demonstrates how to reference an
action in the same repository.
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
- name: Test Local Action
id: test-action
uses: ./
with:
target-branch: 'release'
- name: Print Output
id: output
run: echo "$"
CSVtoJSON is licensed under the GNU General Public License v3.0 License.
Just if you want to support this repository: