Release CUA packages #14
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 AI | |
| on: | |
| push: | |
| tags: | |
| - "cua-ai/v*" | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: release-cua-ai-${{ 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-ai/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/ai/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 | |
| - name: Unit tests | |
| run: npm test --workspace @onkernel/cua-ai | |
| - name: Pack tarball | |
| run: npm pack --workspace @onkernel/cua-ai --pack-destination "$RUNNER_TEMP" | |
| - name: ESM import smoke test | |
| run: | | |
| mkdir -p "$RUNNER_TEMP/esm-smoke" | |
| cd "$RUNNER_TEMP/esm-smoke" | |
| npm init -y | |
| npm install "$RUNNER_TEMP"/onkernel-cua-ai-*.tgz | |
| node --input-type=module -e "import('@onkernel/cua-ai').then((m) => { if (typeof m.getCuaModel !== 'function') process.exit(1); })" | |
| - name: Publish to npm | |
| run: npm publish --workspace @onkernel/cua-ai --access public |