Update npm-publish.yml #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Package to npm | |
on: | |
push: | |
branches: | |
- master # Trigger on push to master branch | |
tags: | |
- 'v*' # Trigger when any tag is pushed | |
jobs: | |
publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm ci | |
- run: npm test | |
- name: Setup .npmrc | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
echo "Created .npmrc:" | |
cat ~/.npmrc | |
- name: Debug NPM config | |
run: | | |
echo "NPM Version:" | |
npm --version | |
echo "NPM Config:" | |
npm config list | |
echo "Package.json content:" | |
cat package.json | |
- name: Publish to NPM | |
run: npm publish --verbose | |
- name: Debug publish failure | |
if: failure() | |
run: | | |
echo "NPM logs:" | |
cat /home/runner/.npm/_logs/*.log |