publish from GitHub Actions with npm's trusted publishing, no one-time password [skip ci]

.github/workflows/publish.yml runs the tests (in a throwaway HOME) and
scripts/publish.sh on each package.json change pushed to main, or by hand;
npm's OIDC exchange stands in for a token and an OTP. Every package now
names magpie-community/plugins' publish.yml as its trusted publisher on
npmjs.com, and gets the repository field npm checks it against.
This commit is contained in:
yetone
2026-10-03 00:00:23 +08:00
parent d7d8d61c42
commit 8f25b63718
13 changed files with 58 additions and 12 deletions
+33
View File
@@ -0,0 +1,33 @@
# Publishes every package whose version isn't on npm yet, from GitHub
# Actions with npm's trusted publishing (OIDC): no token and no one-time
# password. Each package names this workflow as its trusted publisher on
# npmjs.com (package → Settings → Trusted Publisher).
name: publish
on:
push:
branches: [main]
paths: ["packages/*/package.json"]
workflow_dispatch:
permissions:
id-token: write # npm's OIDC exchange
contents: read
concurrency: publish
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: 24 # npm 11.5+, which speaks trusted publishing
registry-url: https://registry.npmjs.org
- name: test
# the tests refuse a real home: no real sign-in is ever read
run: HOME=$(mktemp -d) bun test
- name: publish
run: scripts/publish.sh
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "cline", "clinepass"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/cline" }
}
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "commandcode"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/commandcode" }
}
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "cursor"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/cursor" }
}
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "devin", "windsurf"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/devin" }
}
+2 -1
View File
@@ -6,5 +6,6 @@
"main": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "factory", "droid"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/factory" }
}
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "kiro"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/kiro" }
}
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "xiaomi", "mimo"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/mimo" }
}
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "minimax", "mcode", "minimax-code"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/minimax" }
}
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md", "LICENSE-CLIProxyAPI"],
"keywords": ["opencode", "opencode-plugin", "magpie", "qoder", "qoder-cn"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/qoder" }
}
+2 -1
View File
@@ -7,5 +7,6 @@
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "workbuddy", "codebuddy"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/workbuddy" }
}
+2 -1
View File
@@ -6,5 +6,6 @@
"main": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "zed"],
"license": "MIT"
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/zed" }
}
+3 -1
View File
@@ -1,6 +1,8 @@
#!/bin/sh
# Publishes every package whose version isn't on npm yet.
# scripts/publish.sh <otp> (the one-time password of the npm account)
# scripts/publish.sh [otp] (by hand: the npm account's one-time password)
# GitHub Actions runs it with no password on each version bump pushed to
# main (.github/workflows/publish.yml, npm's trusted publishing).
# One password covers the lot: it is sent with each publish while it lasts.
set -e
cd "$(dirname "$0")/.."