Skip to content

v0.15.0

v0.15.0 #6

Workflow file for this run

name: Publish to npm
on:
release:
types: [published]
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
permissions:
contents: write # Needed to comment on release
id-token: write # Required for npm provenance
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run type checking
run: bun check-types
- name: Run linting
run: bun lint:check
- name: Run unit tests
run: bun run test:unit
- name: Build package
run: bun run build
- name: Verify dist/ exists
run: |
if [ ! -d "dist" ]; then
echo "Error: dist/ directory not found"
exit 1
fi
if [ ! -f "dist/cli.js" ]; then
echo "Error: dist/cli.js not found"
exit 1
fi
echo "✅ Build artifacts verified"
- name: Setup Node.js (for npm publish)
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Comment on release
uses: actions/github-script@v7
with:
script: |
const release = context.payload.release;
const packageName = '@arittr/commitment';
const version = release.tag_name.replace(/^v/, '');
await github.rest.repos.createCommitComment({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: release.target_commitish,
body: `📦 Published ${packageName}@${version} to npm\n\n🔗 https://www.npmjs.com/package/${packageName}/v/${version}`
});