Every publish run on main since 13:27 UTC 10-14 is red: opencode-zed-auth 0.1.7 and opencode-zen-free-auth 0.1.6 answer 404 because their Trusted Publisher isn't set, and a new package (opendesign-auth, AstraFlow) can't be created by OIDC at all. Each of those needed an org owner's OTP by hand. npm tries OIDC first and falls back to the token in .npmrc, so publish.yml now hands setup-node's NODE_AUTH_TOKEN the repository's NPM_TOKEN secret. publish.sh publishes a new package when the token is there instead of passing it by, and its errors say which of the two is missing or that the token expired. The PR check now notes a new package instead of failing, since the merge publishes it. README gains a Publishing section with the one-time token setup. Run: sh -n on both scripts; scripts/new-to-npm.sh against npm (every package is on npm); scripts/publish.sh with GITHUB_ACTIONS=true and a fake npm on PATH (zed-auth "new"): token -> published with the token, exit 0; no token -> ::error naming it, exit 1; token refused -> ::error saying replace the token, exit 1. Not tried: a real publish with a token, since the secret doesn't exist yet.
40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
# Publishes every package whose version isn't on npm yet, from GitHub
|
|
# Actions. npm tries trusted publishing (OIDC) first: a package that names
|
|
# this workflow as its Trusted Publisher on npmjs.com needs nothing else.
|
|
# What OIDC can't do, the NPM_TOKEN secret does: a package's first version
|
|
# (trusted publishing can't create one) and a package whose Trusted
|
|
# Publisher isn't set. NPM_TOKEN is an npm granular access token of a
|
|
# magpie-community owner: read and write to the @magpie-community scope,
|
|
# 2FA bypassed. With it nobody publishes by hand.
|
|
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
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|