Skip to content

Release

Release #5

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. 0.13.0)'
required: true
branch:
description: 'Branch to release from'
required: true
default: 'main'
permissions:
contents: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 30
environment: npm
steps:
- name: Validate version format
run: |
if ! echo "${{ github.event.inputs.version }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
echo "::error::Invalid version format: ${{ github.event.inputs.version }}"
echo "Version must be in semver format (e.g. 0.13.0 or 1.0.0-beta.1)"
exit 1
fi
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
ref: ${{ github.event.inputs.branch }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Install dependencies
run: npm install
- name: Set version
run: npm version ${{ github.event.inputs.version }} -m "Release %s"
- name: Publish to npm
run: npm publish --provenance --access public
- name: Push version commit and tag
run: |
git push origin ${{ github.event.inputs.branch }}
git push origin v${{ github.event.inputs.version }}
- name: Generate API docs
run: npm run docs:api
- name: Upload API docs artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: apidocs-${{ github.event.inputs.version }}
path: out/
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v${{ github.event.inputs.version }}" \
--target "${{ github.event.inputs.branch }}" \
--title "v${{ github.event.inputs.version }}" \
--generate-notes