Publish to NPM #23
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 to NPM | |
on: | |
workflow_run: | |
workflows: [ "Release" ] | |
types: | |
- completed | |
jobs: | |
publish-npm: | |
if: github.event.workflow_run.conclusion == 'success' | |
name: Publish to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set version | |
id: vars | |
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- name: Setup Git user | |
run: | | |
git config --global user.name "Github Bot" | |
git config --global user.email "[email protected]" | |
- name: Create .npmrc file | |
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: NPM publish | |
run: npm publish --access public | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |