Skip to content

Commit

Permalink
Update npm-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
skrulling authored Jan 30, 2024
1 parent b845934 commit 4351643
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ jobs:
- name: Create .npmrc file
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

- name: Check if version has changed
id: check-version
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
NPM_VERSION=$(npm view [package-name] version || echo '0.0.0')
if [ "$PACKAGE_VERSION" = "$NPM_VERSION" ]; then
echo "::set-output name=changed::false"
else
echo "::set-output name=changed::true"
fi
- name: Publish to npm
if: steps.check-version.outputs.changed == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 4351643

Please sign in to comment.