This is a GitHub Action that bumps version of a NPM Package.
The version is formatted according to the pattern described in the RFC-18:
<base-version>-<environment>.<build-number>+<branch>.<commit>
The action supports following input parameters:
-
work-dir
(optional, default:.
) - location ofpackage.json
file, -
is-prerelease
(optional, default:true
) - defines if the version is a prerelease, currently onlytrue
is supported, -
environment
(optional, default:pre
) - prerelease id. -
branch
(optional) - branch reference at which version is built -
commit
(optional) - commit hash at which version is built
It's expected that branch
parameter will be populated with GitHub context ref
property:
The branch or tag ref that triggered the workflow run. For branches this in the format refs/heads/<branch_name>, and for tags it is refs/tags/<tag_name>.
To handle this value correctly in the resulting version format the provided value is converted in the following way:
-
refs/heads/
andrefs/tag/
prefixes are stripped out, -
any
/
occurrence is replaced by-
, -
any
.
occurrence is replaced with-
.
- uses: keep-network/npm-version-bump@v2
with:
work-dir: ./contracts # optional, default: .
environment: "ropsten" # optional, default: pre
branch: ${{ github.ref }} # optional
commit: ${{ github.sha }} # optional
The action outputs version
property with a value of the resolved package version.
Example usage:
- uses: keep-network/npm-version-bump@v2
id: bump-version
- name: Print resolved version
run: echo "Resolved new version ${{ steps.bump-version.outputs.version }}"