This Action scans for a package.json file and reads the version number from that.
Find a file
2023-04-03 11:19:30 +02:00
action.yml Update action.yml 2020-07-13 13:17:13 +02:00
Dockerfile Add jq to Dockerfile (#18) 2022-04-20 11:47:50 +02:00
entrypoint.sh Use GITHUB_OUTPUT instead of set-output (#25) 2022-10-31 09:50:36 +01:00
LICENSE Create LICENSE 2021-03-30 09:26:18 +02:00
README.md fix: readme had wrong value (#29) 2023-04-03 11:19:30 +02:00

npm-get-version-action

This GitHub Action retrieves the package version from the package.json file and sets the version in the current-version output value usable in your workflow file.

Example

To use this action in your project, use the following:

- name: get-npm-version
  id: package-version
  uses: martinbeentjes/npm-get-version-action@v1.3.1

The Action sets an output variable called current-version which can be used in a following step by using ${{ steps.package-version.outputs.current-version}}.

If you are using a monorepo or otherwise have some packages in a subdirectory of your repo, add the path to the package.json as a parameter:

- name: get-npm-version
  id: package-version
  uses: martinbeentjes/npm-get-version-action@v1.3.1
  with:
    path: packages/<yourpackage>