Skip to content

culshaw/read-package-node-version-actions

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

Read node version from engines field in package.json

Read your node version from package.json

Example workflow

package.json

{
  "name": "your-package",
  "engines": {
    "node": "12.13.x"
  }
}

.github/workflow/test.yml

name: Get node version from package.json

on: push

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - name: Read node from package.json
        uses: culshaw/read-package-node-version-actions@v1
        id: package-node-version

      - name: Show node version number
        run: echo "Version is ${{ steps.package-node-version.outputs.version }}"
        # Version is 12.13.x

Inputs

path

Path of package.json, ./ by default.

path/to/package.json

{
  "name": "your-package",
  "engines": {
    "node": "12.13.x"
  }
}
name: Get version from package.json

on: push

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - name: Read node from package.json
        uses: culshaw/read-package-node-version-actions@v1
        with: 
          path: "./path/to/package.json"
        id: package-node-version

      - name: Show version number
        run: echo "Version is ${{ steps.package-version.outputs.version }}"
        # Version is 12.13.x

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 74.1%
  • TypeScript 25.9%