Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,44 @@ name: Publish Package to npmjs
on:
release:
types: [published]
workflow_dispatch:
inputs:
npm_tag:
description: npm distribution tag
required: true
default: beta
type: choice
options:
- beta
- latest

permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '22.x'
node-version: '24.x'
registry-url: 'https://registry.npmjs.org'
cache: npm
- run: npm ci
- run: npm test
- name: Publish package
run: |
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
NPM_TAG="${{ inputs.npm_tag }}"
elif [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
NPM_TAG="beta"
else
NPM_TAG="latest"
fi

if [[ "$NPM_TAG" == "beta" ]]; then
npm publish --tag beta
else
npm publish
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading