Skip to content

chore: migrate to npm, tsx, native test runner #10

chore: migrate to npm, tsx, native test runner

chore: migrate to npm, tsx, native test runner #10

Workflow file for this run

name: ci
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
name: node-${{ matrix.node-version }}
strategy:
fail-fast: false
matrix:
# https://nodejs.org/en/about/previous-releases#nodejs-releases
node-version: [22, 24, 25]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm i -g npm@latest && npm i
- run: npm run ci
release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: test
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- run: npm i -g npm@latest && npm i
- name: Check package.json version matches tag
run: |
TAG="${{ github.ref_name }}"
PKG_VERSION="v$(node -p "require('./package.json').version")"
if [ "$TAG" != "$PKG_VERSION" ]; then
echo "Error: tag ${TAG} does not match package.json version ${PKG_VERSION}"
exit 1
fi
- run: npm run build
- name: Extract changelog entry
run: |
VERSION="${{ github.ref_name }}"
NOTES=$(awk "/^## ${VERSION}/{found=1; next} /^## /{found=0} found" changelog.md)
if [ -z "$NOTES" ]; then
echo "Error: no changelog entry found for ${VERSION}"
exit 1
fi
echo "$NOTES" > release_notes.txt
- run: npm publish --provenance --access public
- run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-file release_notes.txt
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}