Skip to content

Publish npm packages #9

Publish npm packages

Publish npm packages #9

Workflow file for this run

name: Publish npm packages
on:
workflow_dispatch:
inputs:
package:
description: Package to publish
required: true
type: choice
default: '@goodwidget/superfluid-campaign-widget'
options:
- all
- '@goodwidget/ai-credits-widget'
- '@goodwidget/citizen-claim-widget'
- '@goodwidget/claim-widget-theme-demo'
- '@goodwidget/core'
- '@goodwidget/embed'
- '@goodwidget/goodreserve-widget'
- '@goodwidget/governance-widget'
- '@goodwidget/staking-migration-widget'
- '@goodwidget/streaming-widget'
- '@goodwidget/superfluid-campaign-widget'
- '@goodwidget/ui'
concurrency:
group: npm-publish-${{ github.ref }}-${{ inputs.package }}
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org
cache: pnpm
- name: Resolve package filter
id: filter
run: |
if [ "${{ inputs.package }}" = "all" ]; then
echo "build=./packages/**" >> "$GITHUB_OUTPUT"
echo "publish=./packages/**" >> "$GITHUB_OUTPUT"
echo "recursive=true" >> "$GITHUB_OUTPUT"
else
echo "build=${{ inputs.package }}..." >> "$GITHUB_OUTPUT"
echo "publish=${{ inputs.package }}" >> "$GITHUB_OUTPUT"
echo "recursive=false" >> "$GITHUB_OUTPUT"
fi
- name: Verify npm version (OIDC)
run: npm --version
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm --filter '${{ steps.filter.outputs.build }}' -r run build
- name: Lint packages
run: pnpm --filter '${{ steps.filter.outputs.publish }}' -r run lint
- name: Publish packages
run: |
if [ "${{ steps.filter.outputs.recursive }}" = "true" ]; then
pnpm -r --filter '${{ steps.filter.outputs.publish }}' publish --access public --no-git-checks
else
pnpm --filter '${{ steps.filter.outputs.publish }}' publish --access public --no-git-checks
fi