Files
plugins/.github/workflows/publish.yml
T
yetone 8f25b63718 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.
2026-10-03 00:00:23 +08:00

34 lines
955 B
YAML

# 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