Skip to content

v1.1.0

v1.1.0 #10

Workflow file for this run

name: Publish Package
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 1.2.3 or 1.2.3-beta.1)'
required: true
type: string
tag:
description: 'npm tag (use "latest" for stable, or custom tag for prereleases)'
required: false
default: 'latest'
type: string
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '22'
# DO NOT use registry-url - it interferes with OIDC
- name: Upgrade npm to 11.x (required for OIDC)
run: npm install -g npm@latest
- name: Configure npm registry
run: npm config set registry https://registry.npmjs.org/
- name: Determine version and tag
id: version
run: |
if [ "${{ github.event_name }}" = "release" ]; then
# From release event - extract version from tag
release_tag="${{ github.event.release.tag_name }}"
version=$(echo "$release_tag" | sed 's/^v//')
tag="latest"
else
# From workflow_dispatch - use inputs
version="${{ inputs.version }}"
tag="${{ inputs.tag }}"
fi
echo "Version: $version"
echo "Tag: $tag"
echo "version=$version" >> $GITHUB_OUTPUT
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Update package.json version
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version
- run: npm install
- name: Publish to npm via OIDC
run: npm publish --access public --provenance --tag ${{ steps.version.outputs.tag }}