Skip to content

Commit 2f359f4

Browse files
jaymaycryclaude
andcommitted
Add GitHub Actions for CI and npm release
Release workflow publishes to npm on v* tags using npm Trusted Publishing (OIDC) — no NPM_TOKEN secret needed. CI workflow runs the bob build on pull requests and pushes to main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bc4ed4f commit 2f359f4

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
build:
10+
name: Typecheck & build
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '22'
20+
cache: 'yarn'
21+
22+
- name: Install dependencies
23+
run: yarn install --frozen-lockfile
24+
25+
- name: Build (bob)
26+
run: yarn prepare

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
publish:
14+
name: Publish to npm
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '22'
24+
registry-url: 'https://registry.npmjs.org'
25+
cache: 'yarn'
26+
27+
- name: Install dependencies
28+
run: yarn install --frozen-lockfile
29+
30+
- name: Verify tag matches package.json version
31+
run: |
32+
PKG_VERSION=$(node -p "require('./package.json').version")
33+
TAG_VERSION="${GITHUB_REF_NAME#v}"
34+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
35+
echo "Tag $GITHUB_REF_NAME (version $TAG_VERSION) does not match package.json version $PKG_VERSION"
36+
exit 1
37+
fi
38+
39+
- name: Build
40+
run: yarn prepare
41+
42+
- name: Upgrade npm (Trusted Publishing requires >= 11.5.1)
43+
run: npm install -g npm@latest
44+
45+
- name: Publish
46+
run: npm publish --access public

0 commit comments

Comments
 (0)