Skip to content

Publish Package to npmjs #3

Publish Package to npmjs

Publish Package to npmjs #3

Workflow file for this run

name: Publish Package to npmjs
on:
release:
types: [published]
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # get the non-merge commit for PRs
fetch-tags: true # include tags to get correct git version
- uses: actions/setup-node@v6
with:
node-version: '23.x'
registry-url: 'https://registry.npmjs.org'
- name: Install meson and emscripten
run: |
sudo apt update -y
sudo apt install -y meson ninja-build build-essential emscripten
- name: Install node dependencies and build the project
run: |
npm ci
npm run build
# https://hackernoon.com/how-to-automatically-publish-your-npm-package-using-github-actions
# Here we actually use `npm version from-git`, but just never commit the version.
- name: Update package.json with release tag
run: |
npm version from-git --no-git-tag-version --allow-same-version
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}