Node.js Package Information
ActionsTags
(2)A GitHub Action for retrieving information from a package.json file, similar to npm pkg get, with some extra ✨.
Publishing a prerelease version of a package can be tricky. By default, npm publish ignores the prerelease identifier, and doesn't take into consideration the tag defined in the package's version field.
Using @geekyeggo/npm-pkg solves this by parsing the version.tag from the package.json file; for example, given a version of 1.2.3-beta.0, a workflow can access the tag directly:
npm publish --tag {{ steps.pkg.outputs.version-tag }}
See action.yml
steps:
  - uses: actions/checkout@v4
  - uses: geekyeggo/npm-pkg@v1
    id: pkg
  # When version is "1.0.0-rc.1", the tag output will be "rc".
  - run: echo ${{ steps.pkg.outputs.version-tag }}| Name | Description | 
|---|---|
| path | Optional path to the package.json file; default "./package.json". | 
| Name | Description | 
|---|---|
| version-major | Major version number | 
| version-minor | Minor version number | 
| version-patch | Patch version number | 
| version-tag | Tag parsed from the prerelease identifier, for example "beta"; default"latest". | 
Interested in more outputs? Consider creating a pull request. 💙
Node.js Package Information 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.