Skip to content

Publish to NPM

Publish to NPM #23

Workflow file for this run

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 }}