-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (79 loc) · 3.18 KB
/
Copy pathrelease-browser-loop.yml
File metadata and controls
97 lines (79 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release Browser Loop
on:
push:
tags:
- "browser-loop/v*"
permissions:
contents: read
id-token: write
concurrency:
group: release-browser-loop-${{ github.ref_name }}
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Verify tag is on main
run: |
git fetch origin main:refs/remotes/origin/main
git merge-base --is-ancestor "$GITHUB_SHA" origin/main
- uses: actions/setup-node@v5
with:
node-version: 24
registry-url: https://registry.npmjs.org
- name: Ensure npm supports trusted publishing
run: npm install -g npm@^11.5.1
- run: npm run check:lockfile
- run: npm ci
- name: Verify package version matches tag
run: |
node --input-type=module <<'NODE'
import { readFileSync } from "node:fs";
const tag = process.env.GITHUB_REF_NAME;
const prefix = "browser-loop/v";
if (!tag?.startsWith(prefix)) {
throw new Error(`Expected tag to start with ${prefix}, got ${tag}`);
}
const tagVersion = tag.slice(prefix.length);
const pkg = JSON.parse(readFileSync("packages/browser-loop/package.json", "utf8"));
if (pkg.version !== tagVersion) {
throw new Error(`Tag version ${tagVersion} does not match ${pkg.name} package.json version ${pkg.version}`);
}
console.log(`${pkg.name}@${pkg.version}`);
NODE
- run: npm run build --workspace @onkernel/browser-loop
- run: npm run typecheck --workspace @onkernel/browser-loop
- name: Unit tests
run: npm test --workspace @onkernel/browser-loop
- name: Pack tarball
run: npm pack --workspace @onkernel/browser-loop --pack-destination "$RUNNER_TEMP"
- name: ESM import smoke test
run: |
SMOKE_DIR=$(mktemp -d)
cd "$SMOKE_DIR"
npm init -y > /dev/null
npm install "$RUNNER_TEMP"/onkernel-browser-loop-*.tgz
cat > smoke.mjs <<'NODE'
import { compileLoopToolCatalog, formatBrowserActResult, loop } from "@onkernel/browser-loop";
import * as loopPi from "@onkernel/browser-loop/pi";
const { attach, createLoopModels, getLoopModel } = loopPi;
for (const [name, value] of Object.entries({ compileLoopToolCatalog, formatBrowserActResult, attach, createLoopModels, getLoopModel })) {
if (typeof value !== "function") {
throw new Error(`expected ${name} to be a function, got ${typeof value}`);
}
}
if (typeof loop !== "object" || loop === null) {
throw new Error(`expected loop to be an object, got ${typeof loop}`);
}
if ("Agent" in loopPi || "NodeExecutionEnv" in loopPi) {
throw new Error("expected @onkernel/browser-loop/pi not to re-export pi-agent-core");
}
console.log("ESM import smoke OK");
NODE
node smoke.mjs
- name: Publish to npm
run: npm publish --workspace @onkernel/browser-loop --access public