Skip to content

Commit fc204c7

Browse files
7schmiedeclaude
andcommitted
distribution: migrate npm publish to Trusted Publishers, finalise landing page
Switch the release workflow from a long-lived npm token to OIDC Trusted Publishing — drops the COMPOSIT_DEPLOY_TOKEN dependency, adds id-token: write permission to the npm job, upgrades npm to the OIDC-capable line, and emits provenance attestations on publish. Each of the six packages still has to list this workflow as a Trusted Publisher on npmjs.com (Repository: nuetzliches/composit, Workflow: release.yml) for the publish to succeed. Landing page: drop the "soon" badges and "requires first release" hedges from the brew, npx, and curl tabs — all three channels are live for v0.3.1. Update the npx tab to reference @nutz/composit (the @composit scope on npm is owned by someone else). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 08f42d1 commit fc204c7

2 files changed

Lines changed: 22 additions & 26 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,49 +188,45 @@ jobs:
188188
name: Publish to npm
189189
runs-on: ubuntu-latest
190190
needs: release
191-
# Requires the secret COMPOSIT_DEPLOY_TOKEN (an npm automation token
192-
# with publish rights to the @nutz scope). When the secret is absent
193-
# the job short-circuits so the rest of the release still completes.
194-
env:
195-
NPM_TOKEN: ${{ secrets.COMPOSIT_DEPLOY_TOKEN }}
191+
# Auth via npm Trusted Publishers (OIDC). Each of the six packages
192+
# (@nutz/composit + 5 platform sub-packages) must list this workflow
193+
# as a Trusted Publisher on npmjs.com — otherwise publish fails with
194+
# 401. No long-lived NPM_TOKEN required.
195+
permissions:
196+
id-token: write
197+
contents: read
196198
steps:
197199
- uses: actions/checkout@v6
198-
if: env.NPM_TOKEN != ''
199200
- uses: actions/setup-node@v4
200-
if: env.NPM_TOKEN != ''
201201
with:
202202
node-version: 20
203203
registry-url: https://registry.npmjs.org
204+
- name: Upgrade npm to OIDC-capable version
205+
run: npm install -g npm@latest
204206
- uses: actions/download-artifact@v8
205-
if: env.NPM_TOKEN != ''
206207
with:
207208
pattern: composit-*
208209
path: artifacts
209210
- name: Flatten artifacts
210-
if: env.NPM_TOKEN != ''
211211
shell: bash
212212
run: |
213213
set -euo pipefail
214214
mkdir -p artifacts-flat
215215
find artifacts -type f \( -name '*.tar.gz' -o -name '*.zip' \) -exec cp {} artifacts-flat/ \;
216216
ls -la artifacts-flat
217217
- name: Build sub-packages
218-
if: env.NPM_TOKEN != ''
219218
shell: bash
220219
run: |
221220
set -euo pipefail
222221
VERSION="${GITHUB_REF#refs/tags/v}"
223222
node install/npm/build-packages.mjs "$VERSION" artifacts-flat dist/npm
224223
- name: Publish platform sub-packages, then meta
225-
if: env.NPM_TOKEN != ''
226224
shell: bash
227-
env:
228-
NODE_AUTH_TOKEN: ${{ secrets.COMPOSIT_DEPLOY_TOKEN }}
229225
run: |
230226
set -euo pipefail
231227
for d in dist/npm/*/; do
232228
name=$(basename "$d")
233229
[ "$name" = "meta" ] && continue
234-
(cd "$d" && npm publish --access public)
230+
(cd "$d" && npm publish --provenance --access public)
235231
done
236-
(cd dist/npm/meta && npm publish --access public)
232+
(cd dist/npm/meta && npm publish --provenance --access public)

landing/index.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,16 @@ <h2>Quick start</h2>
485485
codespaces <span class="tab-badge badge-ok">available</span>
486486
</button>
487487
<button class="tab-btn" role="tab" data-tab="brew">
488-
brew <span class="tab-badge badge-soon">soon</span>
488+
brew <span class="tab-badge badge-ok">available</span>
489489
</button>
490490
<button class="tab-btn" role="tab" data-tab="npx">
491-
npx <span class="tab-badge badge-soon">soon</span>
491+
npx <span class="tab-badge badge-ok">available</span>
492492
</button>
493493
<button class="tab-btn active" role="tab" data-tab="cargo">
494494
cargo <span class="tab-badge badge-ok">available</span>
495495
</button>
496496
<button class="tab-btn" role="tab" data-tab="curl">
497-
curl <span class="tab-badge badge-soon">soon</span>
497+
curl <span class="tab-badge badge-ok">available</span>
498498
</button>
499499
<button class="tab-btn" role="tab" data-tab="docker">
500500
docker <span class="tab-badge badge-ok">available</span>
@@ -521,7 +521,7 @@ <h2>Quick start</h2>
521521
<!-- brew -->
522522
<div class="tab-panel" id="tab-brew" role="tabpanel">
523523
<div class="tab-panel-header">
524-
<span>macOS · Linux — requires first release</span>
524+
<span>macOS · Linux</span>
525525
</div>
526526
<div class="tab-section">
527527
<div class="tab-section-head">
@@ -532,24 +532,24 @@ <h2>Quick start</h2>
532532
brew tap nuetzliches/tap
533533
brew install composit</pre>
534534
</div>
535-
<div class="tab-note">Formula at <a href="https://github.com/nuetzliches/composit/blob/main/install/brew/composit.rb" target="_blank" rel="noopener">install/brew/composit.rb</a> — SHA256 placeholders filled on first GitHub release.</div>
535+
<div class="tab-note">Formula tracked at <a href="https://github.com/nuetzliches/homebrew-tap/blob/main/Formula/composit.rb" target="_blank" rel="noopener">nuetzliches/homebrew-tap</a>; auto-bumped by the release workflow.</div>
536536
</div>
537537

538538
<!-- npx -->
539539
<div class="tab-panel" id="tab-npx" role="tabpanel">
540540
<div class="tab-panel-header">
541-
<span>Zero-install · CI-friendly — requires first release</span>
541+
<span>Zero-install · CI-friendly</span>
542542
</div>
543543
<div class="tab-section">
544544
<div class="tab-section-head">
545545
<span>Use</span>
546-
<button type="button" class="qs-copy" data-copy="npx @composit/cli init">Copy</button>
546+
<button type="button" class="qs-copy" data-copy="npx @nutz/composit init">Copy</button>
547547
</div>
548548
<pre><span class="comment"># No install step — npx downloads on first use.</span>
549-
npx @composit/cli init
550-
npx @composit/cli diff --output json</pre>
549+
npx @nutz/composit init
550+
npx @nutz/composit diff --output json</pre>
551551
</div>
552-
<div class="tab-note">Meta-package at <a href="https://github.com/nuetzliches/composit/blob/main/install/npm/package.json" target="_blank" rel="noopener">install/npm/</a> selects a platform binary via optional dependencies (biome / esbuild pattern).</div>
552+
<div class="tab-note">Meta-package <a href="https://www.npmjs.com/package/@nutz/composit" target="_blank" rel="noopener">@nutz/composit</a> selects a platform binary via optional dependencies (biome / esbuild pattern).</div>
553553
</div>
554554

555555
<!-- cargo -->
@@ -571,7 +571,7 @@ <h2>Quick start</h2>
571571
<!-- curl -->
572572
<div class="tab-panel" id="tab-curl" role="tabpanel">
573573
<div class="tab-panel-header">
574-
<span>macOS · Linux — requires first release</span>
574+
<span>macOS · Linux</span>
575575
</div>
576576
<div class="tab-section">
577577
<div class="tab-section-head">

0 commit comments

Comments
 (0)