Skip to content

create a release and pulish to npm only if we taged a new tag #4

create a release and pulish to npm only if we taged a new tag

create a release and pulish to npm only if we taged a new tag #4

Workflow file for this run

name: Release and Publish to npm
on:
push:
branches: main
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
make_latest: true
publish:
if: startsWith(github.ref, 'refs/tags/')
name: Publish to npm
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '20'
- run: |
npm ci
npm run build
- uses: JS-DevTools/npm-publish@v3
with:
access: public
token: ${{ secrets.NPM_TOKEN }}