Skip to content

Get current package version

Actions
Get the current version of the npm package
v1.3.1
Latest
Star (156)

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>

Get current package version is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Get the current version of the npm package
v1.3.1
Latest

Get current package version is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.