Skip to content

0.1.8

0.1.8 #24

Workflow file for this run

name: CI
on:
push:
branches: [ main, master ]
pull_request:
permissions:
contents: read
id-token: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
environment: CI
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run type-check
- run: npm test -- --ci --coverage
build:
name: Build
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run build
publish:
name: Publish to npm
needs: build
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
environment: CI
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
always-auth: true
- name: Verify NPM_TOKEN is configured
run: |
if [ -z "$NPM_TOKEN" ]; then
echo "::error::NPM_TOKEN is not configured. Add it in GitHub → Settings → Secrets and variables → Actions (name: NPM_TOKEN).";
exit 1;
fi
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm ci
- name: Configure npm auth (fallback)
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}