Skip to content

Commit 4f89b10

Browse files
docs: update publish docs to reflect OIDC auth instead of NPM_TOKEN
Address PR review comments: - Replace NPM_TOKEN references with npm OIDC setup instructions - Fix platform names (linux-arm-gnu not linux-armv7-gnu) - Add OIDC-specific failure scenarios in stress test - Update manual steps with trusted publisher setup
1 parent cfb3eb8 commit 4f89b10

File tree

5 files changed

+58
-40
lines changed

5 files changed

+58
-40
lines changed

.specs/publish/first/PREP/03-CONSTANTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
### C3: GitHub Repository
1616
- `effect-native/ansilust` exists
1717
- GitHub Actions enabled
18-
- GitHub Actions must be configured for npm OIDC authentication (no NPM_TOKEN secret required)
18+
- npm OIDC authentication configured (no NPM_TOKEN secret required)
19+
- Workflow has `permissions: id-token: write` for OIDC
1920

2021
### C4: Binary Works
2122
- Native build produces working binaries
@@ -68,7 +69,7 @@
6869
## Immutable Dependencies
6970

7071
### For npm Publish
71-
1. NPM_TOKEN secret in GitHub Actions
72+
1. npm OIDC configured for effect-native org (trusted publisher)
7273
2. All platform packages created and ready
7374
3. launcher.js implemented
7475
4. optionalDependencies point to npm packages (not local files)

.specs/publish/first/PREP/04-STRESS-TEST.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
## What-If Scenarios
44

5-
### WIF-1: NPM_TOKEN Secret Missing
6-
**What if**: GitHub Actions runs but NPM_TOKEN isn't configured?
7-
**Impact**: npm publish fails, CI workflow breaks
8-
**Mitigation**: Check secrets before first release
9-
**Test**: `gh secret list` should show NPM_TOKEN
5+
### WIF-1: npm OIDC Not Configured
6+
**What if**: GitHub Actions runs but npm org doesn't have OIDC configured?
7+
**Impact**: npm publish fails with "No token available" error
8+
**Mitigation**: Configure trusted publisher in npm org settings
9+
**Test**: Check npm package settings show GitHub repo as trusted publisher
10+
11+
### WIF-1b: id-token Permission Missing
12+
**What if**: Workflow doesn't have `permissions: id-token: write`?
13+
**Impact**: GitHub can't issue OIDC token, npm publish fails
14+
**Mitigation**: Ensure permission is set in release.yml (already done)
15+
**Test**: Check workflow YAML for `id-token: write`
1016

1117
### WIF-2: Platform Package Names Wrong
1218
**What if**: npm package names don't match what launcher expects?
@@ -86,7 +92,7 @@
8692

8793
1. **CRITICAL**: launcher.js must exist and work
8894
2. **CRITICAL**: Platform package names must match exactly
89-
3. **HIGH**: All 10 platform packages must publish before meta
90-
4. **HIGH**: NPM_TOKEN must be configured
95+
3. **HIGH**: All 8 platform packages must publish before meta
96+
4. **HIGH**: npm OIDC must be configured (trusted publisher)
9197
5. **MEDIUM**: Cross-compilation must succeed for all targets
9298
6. **LOW**: Help/version flags in binary (nice to have)

.specs/publish/first/PREP/06-IMPACT-ASSESSMENT.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
**Impact**: Cannot test global installation locally
1414
**Resolution**: Symlink directly in node_modules (works for testing)
1515

16-
### FP3: NPM_TOKEN Not Verified
17-
**Issue**: Unknown if secret is configured in GitHub Actions
18-
**Impact**: Could fail on publish
19-
**Resolution**: Check via `gh secret list` before release
16+
### FP3: npm OIDC Not Configured
17+
**Issue**: npm org needs trusted publisher setup for OIDC
18+
**Impact**: Could fail on publish with auth error
19+
**Resolution**: Configure trusted publisher in npm org settings (see MANUAL-STEPS.md)
2020

2121
## What Works
2222

@@ -68,16 +68,17 @@
6868
- Replace std.posix.isatty with cross-platform check
6969
- Replace std.posix.getenv with std.process.getEnvVarOwned
7070

71-
2. **Verify NPM_TOKEN secret exists**
72-
- `gh secret list` to check
71+
2. **Configure npm OIDC**
72+
- Set up trusted publisher in npm org settings
73+
- See MANUAL-STEPS.md for detailed instructions
7374

7475
3. **Test CI workflow**
7576
- Push test tag to see if workflow runs
7677
- Fix any issues before real release
7778

78-
4. **Update release.yml**
79-
- Remove Windows target from build matrix (or handle failure gracefully)
80-
- Add linux-i386-musl back when tested
79+
4. **Update release.yml** (DONE)
80+
- Windows target removed from build
81+
- Single runner builds all targets via Zig cross-compile
8182

8283
5. **Create changeset and release**
8384
- `npx changeset add` - major bump to 1.0.0

.specs/publish/first/SPEC/MANUAL-STEPS.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
# Manual Steps Required Before First Release
22

3-
## 1. Add NPM_TOKEN Secret to GitHub
3+
## 1. Configure npm OIDC Authentication
44

5-
### Option A: Via GitHub Web UI
6-
1. Go to https://github.com/effect-native/ansilust/settings/secrets/actions
7-
2. Click "New repository secret"
8-
3. Name: `NPM_TOKEN`
9-
4. Value: Your npm access token (get from https://www.npmjs.com/settings/~/tokens)
10-
5. Click "Add secret"
5+
The workflow uses npm OIDC authentication for publishing, which is more secure and does **not** require an `NPM_TOKEN` secret. Instead, GitHub Actions exchanges an OIDC token directly with npm.
116

12-
### Option B: Via gh CLI
13-
```bash
14-
# First, get an npm token from https://www.npmjs.com/settings/~/tokens
15-
# Choose "Automation" token type for CI/CD
16-
gh secret set NPM_TOKEN -R effect-native/ansilust
17-
# Paste your token when prompted
18-
```
7+
### Steps to Enable OIDC:
8+
9+
1. **Go to npm organization settings**:
10+
https://www.npmjs.com/settings/effect-native/packages
11+
12+
2. **For each package**, enable "Require two-factor authentication or an automation token, or a token generated by a trusted publisher" under Publishing access
13+
14+
3. **Link GitHub repository as trusted publisher**:
15+
- Go to each package settings
16+
- Under "Publishing access" → "Configure trusted publishers"
17+
- Add `effect-native/ansilust` repository
18+
- Select the `release.yml` workflow
19+
20+
4. **Verify workflow has OIDC permissions** (already configured):
21+
```yaml
22+
permissions:
23+
id-token: write # Required for npm OIDC
24+
```
25+
26+
### References:
27+
- [npm OIDC docs](https://docs.npmjs.com/generating-provenance-statements)
28+
- [GitHub OIDC for npm](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-cloud-providers)
1929
2030
## 2. (Optional) Add AUR_SSH_KEY Secret
2131

.specs/publish/first/SPEC/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ Pushed to: https://github.com/effect-native/ansilust/tree/feat/publish-v1
1616

1717
### What's Broken/Missing
1818
1. **Windows build fails** - POSIX API usage in code (deferred to v1.1.0)
19-
2. **NPM_TOKEN secret not configured** - see MANUAL-STEPS.md
19+
2. **npm OIDC not configured** - see MANUAL-STEPS.md for setup
2020
3. **AUR_SSH_KEY secret not configured** - can skip for v1.0.0
2121
4. **Platform packages created by CI** - assembly script ready
22-
5. **No GitHub release yet** - waiting on NPM_TOKEN
22+
5. **No GitHub release yet** - pending OIDC setup
2323

2424
### Critical Path to v1.0.0
2525

2626
```
27-
1. [MANUAL] Add NPM_TOKEN secret to GitHub repo
27+
1. [MANUAL] Configure npm OIDC for effect-native org (see MANUAL-STEPS.md)
2828
2. [MANUAL] Add AUR_SSH_KEY secret (or skip AUR for v1.0.0)
29-
3. [CODE] Update release.yml to skip Windows target
29+
3. [CODE] Update release.yml to skip Windows target (DONE)
3030
4. [CODE] Create changeset for v1.0.0
3131
5. [CI] Push, let changesets create version PR
3232
6. [MANUAL] Merge version PR
@@ -42,8 +42,8 @@ Pushed to: https://github.com/effect-native/ansilust/tree/feat/publish-v1
4242
| linux-x64-musl | READY | Alpine/containers |
4343
| linux-arm64-gnu | READY | RPi 4, Apple Silicon VMs |
4444
| linux-arm64-musl | READY | Alpine ARM |
45-
| linux-armv7-gnu | READY | RPi 2/3 |
46-
| linux-armv7-musl | READY | Older embedded |
45+
| linux-arm-gnu | READY | RPi 2/3 |
46+
| linux-arm-musl | READY | Older embedded |
4747
| darwin-x64 | READY | Intel Macs |
4848
| darwin-arm64 | READY | Apple Silicon |
4949
| win32-x64 | BLOCKED | POSIX API usage |
@@ -66,11 +66,11 @@ Pushed to: https://github.com/effect-native/ansilust/tree/feat/publish-v1
6666

6767
### Immediate Next Steps
6868

69-
1. **[MANUAL]** Add NPM_TOKEN to GitHub secrets (see MANUAL-STEPS.md)
69+
1. **[MANUAL]** Configure npm OIDC (see MANUAL-STEPS.md)
7070
2. **[OPTIONAL]** Test release with `v0.0.2-test.1` tag
7171
3. **[MANUAL]** Create PR and merge feat/publish-v1 to main
7272
4. **[MANUAL]** Create changeset for v1.0.0
73-
5. **[AUTO]** Release workflow builds and publishes
73+
5. **[AUTO]** Release workflow builds and publishes (using OIDC provenance)
7474

7575
### Later (v1.1.0)
7676

0 commit comments

Comments
 (0)