Skip to content

Publish Package to npmjs #2

Publish Package to npmjs

Publish Package to npmjs #2

Workflow file for this run

# https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow
# https://pnpm.io/continuous-integration#github-actions
name: Publish Package to npmjs
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- run: |
VERSION=$(jq -r '.version' package.json)
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "NPM_CONFIG_TAG=latest" >> $GITHUB_ENV
else
echo "NPM_CONFIG_TAG=next" >> $GITHUB_ENV
fi
- run: pnpm install
- run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_TAG: ${{ env.NPM_CONFIG_TAG }}
NPM_CONFIG_PROVENANCE: true