Skip to content

Commit b07f8f8

Browse files
hiai.ggclaude
andcommitted
ci(release): fix npm publish job (missing Bun), add version guard + dispatch
- publish step now sets up Bun (the old job ran bun install with no Bun installed, silently failing under continue-on-error) - single job: typecheck/test/build/bundle-size gate → npm publish (skip if version already on npm) → GitHub release with tarball - provenance via id-token; manual workflow_dispatch added Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5aa272b commit b07f8f8

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,65 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
78

89
jobs:
9-
build:
10-
name: build & verify
10+
release:
11+
name: build, publish & release
1112
runs-on: ubuntu-latest
1213
permissions:
13-
contents: write
14+
contents: write # create the GitHub release
15+
id-token: write # npm provenance (sigstore)
1416
steps:
1517
- name: Checkout
1618
uses: actions/checkout@v5
1719

18-
- name: Setup bun
20+
- name: Setup Bun
1921
uses: oven-sh/setup-bun@v2
2022
with:
2123
bun-version: 1.3.x
2224

23-
- name: Setup Node.js (for npm pack)
25+
# setup-node writes an .npmrc that authenticates via NODE_AUTH_TOKEN.
26+
- name: Setup Node.js
2427
uses: actions/setup-node@v4
2528
with:
2629
node-version: '20'
30+
registry-url: 'https://registry.npmjs.org'
2731

2832
- name: Install dependencies
2933
run: bun install --frozen-lockfile
3034

31-
- name: Run typecheck
35+
- name: Typecheck
3236
run: bun run typecheck
3337

34-
- name: Run tests
38+
- name: Test
3539
run: bun test
3640

3741
- name: Build
3842
run: bun run build
3943

40-
- name: Pack tarball
41-
run: npm pack
42-
4344
- name: Check bundle size
4445
run: npm run check:bundle-size
4546

47+
- name: Pack tarball
48+
run: npm pack --ignore-scripts
49+
50+
- name: Publish to npm
51+
env:
52+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53+
run: |
54+
version=$(node -p "require('./package.json').version")
55+
if npm view "@hiai-gg/hiai-opencode@${version}" version >/dev/null 2>&1; then
56+
echo "::notice::@hiai-gg/hiai-opencode@${version} already on npm — skipping publish."
57+
else
58+
npm publish --access public --provenance --ignore-scripts
59+
fi
60+
4661
- name: Create GitHub Release
4762
uses: softprops/action-gh-release@v2
4863
with:
4964
generate_release_notes: true
65+
draft: false
66+
prerelease: ${{ contains(github.ref_name, '-') }}
5067
files: |
5168
*.tgz

0 commit comments

Comments
 (0)