Skip to content

v0.2.2 – Cross-Platform Polish #3

v0.2.2 – Cross-Platform Polish

v0.2.2 – Cross-Platform Polish #3

Workflow file for this run

name: Publish Node.js Package
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js (with Corepack/Yarn)
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- run: corepack enable
- name: Install deps (Yarn 4 workspaces)
run: yarn install --immutable
- name: Build (bob via prepare)
run: yarn prepare
- name: Ensure version not already on npm
run: |
NAME="$(node -p "require('./package.json').name")"
VER="$(node -p "require('./package.json').version")"
if npm view "${NAME}@${VER}" version >/dev/null 2>&1; then
echo "::error::${NAME}@${VER} already exists on npm"
exit 1
fi
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public