Adopt pi 0.80's instance-based Models API (#50) #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release CUA Agent | |
| on: | |
| push: | |
| tags: | |
| - "cua-agent/v*" | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: release-cua-agent-${{ 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 ci | |
| - name: Verify package version matches tag | |
| run: | | |
| node --input-type=module <<'EOF' | |
| import { readFileSync } from "node:fs"; | |
| const tag = process.env.GITHUB_REF_NAME; | |
| const prefix = "cua-agent/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/agent/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}`); | |
| EOF | |
| - run: npm run build --workspace @onkernel/cua-ai | |
| - run: npm run build --workspace @onkernel/cua-agent | |
| - run: npm run typecheck --workspace @onkernel/cua-agent | |
| - name: Unit tests | |
| run: npm test --workspace @onkernel/cua-agent -- --exclude "**/*.live.test.ts" | |
| - name: Verify dependency package is published | |
| run: npm view @onkernel/cua-ai@$(node -p 'require("./packages/agent/package.json").dependencies["@onkernel/cua-ai"]') version | |
| - name: Pack tarballs | |
| run: | | |
| mkdir -p /tmp/pack | |
| npm pack --workspace @onkernel/cua-ai --pack-destination /tmp/pack | |
| npm pack --workspace @onkernel/cua-agent --pack-destination /tmp/pack | |
| - name: ESM import smoke test | |
| run: | | |
| SMOKE_DIR=$(mktemp -d) | |
| cd "$SMOKE_DIR" | |
| npm init -y > /dev/null | |
| npm install /tmp/pack/*.tgz | |
| cat > smoke.mjs <<'EOF' | |
| import { CuaAgent, CuaAgentHarness, createCuaComputerTools, NodeExecutionEnv } from "@onkernel/cua-agent"; | |
| for (const [name, value] of Object.entries({ CuaAgent, CuaAgentHarness, createCuaComputerTools, NodeExecutionEnv })) { | |
| if (typeof value !== "function") { | |
| throw new Error(`expected ${name} to be a function, got ${typeof value}`); | |
| } | |
| } | |
| console.log("ESM import smoke OK"); | |
| EOF | |
| node smoke.mjs | |
| - name: Publish to npm | |
| run: npm publish --workspace @onkernel/cua-agent --access public |