Get version string from project file (package.json or project.csproj) https://bbon.kr/github-action-get-version-action/
  • TypeScript 98.2%
  • JavaScript 1.8%
Find a file
Pon Cheol, Ku (구본철) 050c4c0c91
Merge pull request #317 from bbonkr/dev
Release main 🚀
2024-04-07 13:03:46 +09:00
.github chore: Set PR automation #315 2024-04-07 12:55:35 +09:00
__tests__ Nit, typo fix in test results 2023-06-23 09:37:38 +10:00
assets Initial version 2022-01-18 16:58:06 +09:00
dist fix: typo #310 2024-04-06 21:13:50 +09:00
src fix: typo #310 2024-04-06 21:12:56 +09:00
.eslintignore Initial version 2022-01-18 16:58:06 +09:00
.eslintrc.json deps: change workflows #273 2023-07-16 16:00:12 +09:00
.gitattributes Initial version 2022-01-18 16:58:06 +09:00
.gitignore chore: Set PR automation #315 2024-04-07 12:55:35 +09:00
.prettierignore Initial version 2022-01-18 16:58:06 +09:00
.prettierrc.json deps: change workflows #273 2023-07-16 16:00:12 +09:00
action.yml fix: typo #310 2024-04-06 21:12:56 +09:00
jest.config.js Initial version 2022-01-18 16:58:06 +09:00
LICENSE Initial version 2022-01-18 16:58:06 +09:00
package-lock.json deps: change workflows #273 2023-07-16 16:00:12 +09:00
package.json chore: Set PR automation #315 2024-04-07 12:56:58 +09:00
README.md docs: Update README.md #310 2024-04-06 21:20:23 +09:00
tsconfig.json Initial version 2022-01-18 16:58:06 +09:00

Get version action

This is an action to get the version string from project file such as package.json, .csproj (c# sdk style project file)

Usages

steps:
  - name: Checkout
    uses: actions/checkout@v4

  - uses: bbonkr/get-version-action@v1
    id: get_version
    with:
      project: './package.json'
      show_log_message: true
  - 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)
show_log_message Show message or not in the console. Shows error log always even set false. Value has to be true or something else;

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