Skip to content

Computer use CLI for AI agents

ci: use npm trusted publishing

Lahfira6936bb28aa2
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 61e050c96..0fa596612 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -370,6 +370,7 @@ jobs:
with:
node-version: '24'
registry-url: https://registry.npmjs.org
+ package-manager-cache: false
- name: Verify GitHub Release assets
env:
@@ -400,10 +401,8 @@ jobs:
cp ../CHANGELOG.md CHANGELOG.md 2>/dev/null || true
- name: Publish to npm
- run: npm publish --provenance --access public
+ run: npm publish --access public
working-directory: npm
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-skills:
name: Publish Skills to ClawHub
diff --git a/.github/workflows/supply-chain.yml b/.github/workflows/supply-chain.yml
index fbaaea0c7..c77b71482 100644
--- a/.github/workflows/supply-chain.yml
+++ b/.github/workflows/supply-chain.yml
@@ -27,6 +27,13 @@ jobs:
- name: Check release metadata consistency
run: scripts/check-release-consistency.sh
+ - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
+ with:
+ node-version: '24'
+
+ - name: Check npm package and publish policy
+ run: node scripts/check-npm-package.js
+
- name: Cargo dependency policy
uses: EmbarkStudios/cargo-deny-action@6c8f9facfa5047ec02d8485b6bf52b587b7777d1 # v2.0.18
with:
diff --git a/scripts/check-npm-package.js b/scripts/check-npm-package.js
index 407c825e9..48b04db13 100644
--- a/scripts/check-npm-package.js
+++ b/scripts/check-npm-package.js
@@ -1,11 +1,13 @@
#!/usr/bin/env node
const { execFileSync } = require('child_process');
+const { readFileSync } = require('fs');
const { join } = require('path');
const root = join(__dirname, '..');
const npmDir = join(root, 'npm');
const pkg = require(join(npmDir, 'package.json'));
+const releaseWorkflow = readFileSync(join(root, '.github/workflows/release.yml'), 'utf8');
const expectedFiles = [
'bin/agent-desktop.js',
'package.json',
@@ -20,6 +22,22 @@ if (pkg.repository?.url !== 'git+https://github.com/lahfir/agent-desktop.git') {
throw new Error('npm repository URL must be normalized for npm publish');
}
+if (releaseWorkflow.includes('secrets.NPM_TOKEN') || releaseWorkflow.includes('NODE_AUTH_TOKEN')) {
+ throw new Error('release workflow must use npm trusted publishing, not long-lived npm tokens');
+}
+
+if (!releaseWorkflow.includes('id-token: write')) {
+ throw new Error('release workflow must grant id-token: write for npm trusted publishing');
+}
+
+if (!releaseWorkflow.includes('package-manager-cache: false')) {
+ throw new Error('release workflow must disable package manager caching for npm publishing');
+}
+
+if (!releaseWorkflow.includes('npm publish --access public')) {
+ throw new Error('release workflow must publish npm through the trusted-publishing command');
+}
+
const output = execFileSync('npm', ['pack', '--dry-run', '--json'], {
cwd: npmDir,
encoding: 'utf8',