This is an action to get the version string from project file such as package.json
, .csproj
(c# sdk style project file)
Of course, you can do this with a script, but I hope this is a convenient solution for those who find scripts difficult.
Usages
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: bbonkr/get-version-action@v1
id: get_version
with:
project: './package.json'
- name: logging
run: |
echo "version=${{ steps.get_version.outputs.version }}"
echo "major=${{ steps.get_version.outputs.major }}"
echo "minor=${{ steps.get_version.outputs.minor }}"
echo "patch=${{ steps.get_version.outputs.patch }}"
echo "pre-release=${{ steps.get_version.outputs.pre-release }}"
echo "build=${{ steps.get_version.outputs.build }}"
Inputs
Name | Required | Description |
---|---|---|
project | ✅ | Your project file path. Support package.json, .csproj (c# sdk style project file) |
Support file
- package.json
- .csproj (c# sdk style project file)
Outputs
Name | Description |
---|---|
version | version string, If does not find version string, throws exception. |
major | major of version (SEMVER1) |
minor | minor of version (SEMVER1) |
patch | patch of version (SEMVER1) |
pre-release | pre-release of version (SEMVER1) |
build | build of version (SEMVER1) |
e.g.)
input: v1.2.3-pre.4+5
outputs:
version: v1.2.3-pre.4+5
major: 1
minor: 2
patch: 3
pre-release: pre.4
build: 5
Closing
You can see code from GitHub: bbonkr/get-version-action
You can find GitHub Action from GitHub Marketplace: get-version-action
I hope this is a convenient solution for your version management.
Top comments (0)