CI(release): setup npm OIDC Trusted Publisher for monorepo #118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Setup npm OIDC Trusted Publisher for monorepo
Summary
This PR implements npm OIDC (OpenID Connect) Trusted Publisher authentication for secure, automated package publishing in this monorepo. OIDC eliminates the need for long-lived npm tokens, reduces security risks through provenance attestation, and enables verifiable supply chain integrity for all 7 public packages.
What's Changed
Added comprehensive OIDC infrastructure including automated release workflows with provenance generation, provenance monitoring system, and security controls through CODEOWNERS protection. Updated Lerna configuration to match current tooling (pnpm) and enable proper monorepo release management.
Key Changes
New:
.github/workflows/release.ymlAutomated release workflow with OIDC authentication and security hardening:
id-token: writepermission withenvironment: npmfor trusted publishingNPM_CONFIG_PROVENANCE: truefor supply chain attestationpersist-credentials: falseprevents credential leakageTrigger: Manual workflow dispatch only (no automatic releases)
New:
.github/workflows/check-provenance.ymlProactive monitoring system for OIDC provenance configuration:
Trigger: Runs on PR open/synchronize to validate OIDC setup before releases
Packages monitored:
New:
.github/CODEOWNERSSecurity control to prevent unauthorized release workflow modifications:
.github/workflows/release.yml.github/workflows/check-provenance.yml.github/workflows/create-release-pr.yml(reserved for future).github/CODEOWNERS(self-protection)Modified:
lerna.jsonConfiguration updates for accurate release management:
"yarn"to"pnpm"(matches actual package manager used in repository)trueto properly detect merged releases in monorepo history"**/*.md""**/*.test.ts""**/*.test.js""**/test/**""**/__tests__/**"Manual Setup Required
After merging this PR, repository administrators must complete the following one-time setup:
1. Configure GitHub Environment
Create a new GitHub Environment named
npmwith protection rules:Why: The release workflow requires
environment: npmfor OIDC token issuance. Environment protection prevents unauthorized releases.2. Enable Branch Protection (if not already configured)
Ensure
masterbranch has protection rules:Why: Protects release workflows from unauthorized modifications via CODEOWNERS enforcement.
3. Configure npm.js OIDC Trusted Publisher (per package)
For each of the 7 public packages, add the GitHub Actions publisher:
Access Settings:
https://www.npmjs.com/package/<package-name>/accessConfiguration (same for all packages):
Packages requiring setup:
Note: The
check-provenance.ymlworkflow will automatically verify this setup and post PR comments if any package is missing OIDC configuration.Test Plan
Manual Verification Steps
Verify GitHub Environment creation:
npmenvironment exists with correct protection rulesmasterVerify npm.js OIDC configuration:
textlint/editorrelease.ymlnpmTest release workflow (dry-run):
Test provenance check workflow:
check-provenance.ymlruns automaticallyVerify CODEOWNERS protection:
.github/workflows/release.ymlExpected Results
Breaking Changes
None. This PR adds new infrastructure without modifying existing package code or breaking existing workflows.
Additional Notes
Security Improvements
Documentation References
Implementation Pattern
This implementation follows the proven pattern from textlint/textlint repository, which successfully uses OIDC Trusted Publisher for its monorepo releases.
🤖 Generated with Claude Code