Skip to content

Commit

Permalink
add version-check
Browse files Browse the repository at this point in the history
  • Loading branch information
saiteja-madha authored Mar 25, 2024
1 parent 82d5ce7 commit 292b2a2
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will run tests, and publish an npm package when something is pushed to the main branch.
# This workflow will build a Node.js project, run tests, and publish an npm package when something is pushed to the main branch.

name: Publish to npm

Expand All @@ -22,11 +22,26 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout Repository
uses: actions/checkout@v3

- name: Check version changes
uses: EndBug/version-check@v2
id: check

- name: Version update detected
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'

- name: Set up Node.js for NPM
if: steps.check.outputs.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm publish

- name: Publish the package to NPM
if: steps.check.outputs.changed == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 comments on commit 292b2a2

Please sign in to comment.