Skip to content

v2.0.0-rc2

v2.0.0-rc2 #54

Workflow file for this run

name: Publish to NPM
on:
release:
types: [published]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
env:
IS_PUBLISHING: 'YES'
- name: Check if pre-release and publish to NPM
run: |
VERSION=$(node -p "require('./package.json').version")
if [[ "$VERSION" == *"-"* ]]; then
echo "Publishing pre-release: $VERSION"
npm publish --access=public --tag rc
else
echo "Publishing stable release: $VERSION"
npm publish --access=public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}