Skip to content

fix: npm release workflow trigger on main push #5

fix: npm release workflow trigger on main push

fix: npm release workflow trigger on main push #5

Workflow file for this run

name: NPM Release
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Get version from tag
id: version
run: |
TAG=$(git describe --tags --abbrev=0)
VERSION=${TAG#v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Update package.json version
run: |
cd npm
npm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version
- name: Update install.js version
run: |
cd npm/scripts
sed -i "s/const VERSION = '.*'/const VERSION = '${{ steps.version.outputs.VERSION }}'/" install.js
- name: Publish to npm
working-directory: ./npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}