A GitHub Action which extracts the version from github.ref
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Attila Bagossy d681662789
Merge pull request #14 from battila7/dependabot/npm_and_yarn/ansi-regex-4.1.1
chore(deps): bump ansi-regex from 4.1.0 to 4.1.1
2022-03-29 16:16:38 +02:00
dist chore: repackaged the action 2021-01-23 17:37:01 +01:00
src feat: add is-prerelease output if prerelease tag is present 2021-08-20 10:54:38 +05:30
test feat: add is-prerelease output if prerelease tag is present 2021-08-20 10:54:38 +05:30
.gitignore Added the ncc dep and made the action.yml dist-aware 2021-01-05 21:10:46 +01:00
action.yml chore: add is-prerelease output in actions.yml 2021-08-20 11:02:52 +05:30
LICENSE Initial commit 2020-04-05 21:29:41 +02:00
package-lock.json Merge pull request #14 from battila7/dependabot/npm_and_yarn/ansi-regex-4.1.1 2022-03-29 16:16:38 +02:00
package.json chore: bumped version to 2.3.0 2021-08-23 13:47:44 +02:00
README.md fix: typo and copy-pasta fixes in README and action.yml 2021-01-23 17:51:46 +01:00

Get Version Action

A GitHub Action which extracts the version from github.ref.

Finally, you can reliably get the pushed version on every platform. Now includes support for semver!

Outputs

version

The pushed version. If github.ref was refs/tags/v1.2.7 or refs/heads/release/v1.2.7 then the value of this output will be v1.2.7.

version-without-v

The pushed version with the leading v stripped. If github.ref was refs/tags/v1.2.7 then the value of this output will be 1.2.7.

If the version does not start with a leading v character, then the value of this output is the same as that of version.

is-semver

Set to true if the pushed version is a valid semver value. If it's not, then this output will not be set.

major

The semver major version, for example 1 in the case of v1.2.3-ALPHA.0+BUILD.1.

minor

The semver minor version, for example 2 in the case of v1.2.3-ALPHA.0+BUILD.1.

patch

The semver patch version, for example 3 in the case of v1.2.3-ALPHA.0+BUILD.1.

prerelease

The semver prerelease version, for example ALPHA.0 in the case of v1.2.3-ALPHA.0+BUILD.1.

build

The semver build version, for example BUILD.1 in the case of v1.2.3-ALPHA.0+BUILD.1.

Example usage

steps:
    - id: get_version
      uses: battila7/get-version-action@v2

    - run: echo ${{ steps.get_version.outputs.version }}

    - run: echo ${{ steps.get_version.outputs.version-without-v }}