This action outputs a variable 'has-updated' indicating that the package.json version was updated in the most recent commit.
Sets the path to the package.json. Default 'package.json'.
Whether the package.json version has updated.
The current package.json version
jobs:
run-build-if-needed:
runs-on: ubuntu-latest
steps:
- uses: MontyD/package-json-updated-action
id: version-updated
with:
path: package.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v1
if: steps.version-updated.outputs.has-updated
with:
fetch-depth: 1
- uses: actions/setup-node@v1
if: steps.version-updated.outputs.has-updated
with:
node-version: '12.x'
- run: npm install
if: steps.version-updated.outputs.has-updated
- run: npm run build
if: steps.version-updated.outputs.has-updated