Skip to content

feat: add harness (AGENTS.md, tests/harness.test.ts, Makefile) #15

feat: add harness (AGENTS.md, tests/harness.test.ts, Makefile)

feat: add harness (AGENTS.md, tests/harness.test.ts, Makefile) #15

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
id-token: write # required for OIDC trusted publishing
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Upgrade npm to support trusted publishing
run: npm install -g npm@latest
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Publish if version is new
run: |
PACKAGE_NAME=$(node -e "console.log(require('./package.json').name)")
CURRENT=$(node -e "console.log(require('./package.json').version)")
PUBLISHED=$(npm view "$PACKAGE_NAME" version --registry https://registry.npmjs.org 2>/dev/null || echo "0.0.0")
if [ "$CURRENT" != "$PUBLISHED" ]; then
echo "Publishing $PACKAGE_NAME@$CURRENT (was $PUBLISHED on npm)"
npm publish --access public --provenance --registry https://registry.npmjs.org
else
echo "Version $CURRENT already published, skipping"
fi