version-for-publishing
v0.1.7
Published
A github action to retrieve package version for CDN deploys, etc.
Downloads
7
Maintainers
Readme
version-for-publishing
This action generates a new dev version number for a git branch, e.g. 1-0-0
for all projects where the version is part of a json file, e.g. package.json
.
It accepts a json file path and a branch name as input.
No release magic or analyzing changelogs is happening.
The main part of the version, e.g. 1.0.0
will not be touched.
What is happening
- reads a json file - in general a package.json
- check the version field in the json file
- defaults to 1-0-0
- provides the new version string as output of the action
- Now you can do what you want, e.g. commit & push the changes, use it for a build step or anything else :)
Examples
Simple branch
- there is a branch named
develop
and its base branch ismain
- the
package.json
version is1.0.0
- Using this action results in version
1-0-0-develop
Nested branches
- there is a branch named
parent
and its base branch ismain
- now another branch
child
is based onparent
- there is already a version in
parent
-1.0.0-parent.1
- Using this action for
child
results in version1-0-0-child.1
- The nesting is not represented in the version!
Branch names with /
- there is a branch named
feat/next-big-thing
- Using this action for
feat/next-big-thing
results in version1-0-0-next-big-thing.1
Main branch
- there is a branch named
main
- the
package.json
version is1.0.0
- Using this action results in version
1-0-0
Inputs
- branch: The name of the branch to check if the current branch is main or a dev-branch. Default
main
. - filePath: The json file path or file name where the
version
field is present. Defaultpackage.json
.
Outputs
- version: The generated version number.
Example usage
uses: trendoid/[email protected]
with:
branch: feat/version-for-publishing
filePath: ./package.json