Skip to content

v0.6.0

v0.6.0 #9

Workflow file for this run

name: Publish to NPM
on:
release:
types:
- published
permissions:
contents: read
id-token: write
jobs:
verify-ci:
name: Verify CI passed
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- name: Verify CI passed for the release commit
env:
GH_TOKEN: ${{ github.token }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
run_id="$(gh run list \
--repo "${{ github.repository }}" \
--workflow ci.yml \
--branch "$DEFAULT_BRANCH" \
--commit "${{ github.sha }}" \
--event push \
--status completed \
--json databaseId,conclusion \
--jq 'map(select(.conclusion == "success"))[0].databaseId // ""')"
if [ -z "$run_id" ]; then
echo "No successful CI run found for ${{ github.sha }} on $DEFAULT_BRANCH."
echo "Run CI successfully before publishing this release."
exit 1
fi
echo "Found successful CI run: $run_id"
publish:
name: Publish to npm
runs-on: ubuntu-latest
needs: verify-ci
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate release tag
run: |
package_version="$(node -p "require('./package.json').version")"
release_version="${GITHUB_REF_NAME#v}"
if [ "$package_version" != "$release_version" ]; then
echo "Release tag v$release_version does not match package.json version $package_version."
exit 1
fi
- name: Type check
run: pnpm typecheck
- name: Lint
run: pnpm lint
- name: Test
run: pnpm test:coverage
- name: Build
run: pnpm build
- name: Publish to NPM
shell: bash
run: npm publish --provenance --access public