Skip to content

chore(release): 0.4.3 #8

chore(release): 0.4.3

chore(release): 0.4.3 #8

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run typecheck
- run: npm test
- run: npm run build
- name: Verify tag matches package.json version
run: |
pkg=$(node -p "require('./package.json').version")
tag=${GITHUB_REF_NAME#v}
if [ "$pkg" != "$tag" ]; then
echo "::error::Tag v$tag does not match package.json version $pkg"
exit 1
fi
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract CHANGELOG section for this tag
run: |
version=${GITHUB_REF_NAME#v}
awk -v ver="$version" '
/^## \[/ {
if (p) exit
if (index($0, "[" ver "]") == 4) { p=1; print; next }
}
p { print }
' CHANGELOG.md > RELEASE_NOTES.md
if [ ! -s RELEASE_NOTES.md ]; then
echo "::error::No CHANGELOG section found for $version"
exit 1
fi
- uses: softprops/action-gh-release@v2
with:
body_path: RELEASE_NOTES.md