Skip to content

Allows you to get the npm version of the package in your Github Actions workflow

License

Notifications You must be signed in to change notification settings

saionaro/extract-package-version

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

extract-package-version

Allows you to get the npm version of the package in your Github Actions workflow

Usage

Inputs

  • path: The directory where package.json can be found (defaults to root of repo)

Outputs

  • version: The version of current NPM package

Example workflow - get NPM version

on: push

name: Create Build

jobs:
  build:
    name: Create Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: saionaro/[email protected]
        id: package_ver
      # from now you can access the version
      - run: echo ${{ steps.package_ver.outputs.version }}

Example workflow - get NPM version of subdirectory (useful in monorepos)

on: push

name: Create Build

jobs:
  build:
    name: Create Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: saionaro/[email protected]
        id: package_ver
        with:
          path: mysubdir
      # from now you can access the version
      - run: echo ${{ steps.package_ver.outputs.version }}

About

Allows you to get the npm version of the package in your Github Actions workflow

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published