package..github.workflows.release.yml Maven / Gradle / Ivy
name: Publish to npm on Release
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org/'
- name: Install dependencies
run: npm install
- name: Update version in package.json
run: |
RELEASE_VERSION=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//')
npm version $RELEASE_VERSION --no-git-tag-version
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}