Skip to content

fix(ci): repair release workflow for five-package npm publish - #94

Open
vinilana wants to merge 2 commits into
mainfrom
cursor/fix-release-workflow-6352
Open

vinilana wants to merge 2 commits into
mainfrom
cursor/fix-release-workflow-6352

Conversation

@vinilana

Copy link
Copy Markdown
Owner

Summary

Repairs .github/workflows/release.yml so a v* tag push builds, verifies, and publishes all five scoped packages in the correct order, creates a GitHub Release from CHANGELOG.md, and supports safe workflow reruns.

Root cause (why publish kept failing)

Investigation used workflow job metadata (failed step: Publish @dotcontext/mcp in run 28307163833) and npm publish timestamps. Logs for those runs are no longer available (GitHub API 410), but the pattern is consistent across v0.9.x–v1.1.1:

  1. Workflow scope — Since commit 9a41307, the workflow only dry-ran/published @dotcontext/mcp. The other four packages were always manual per CONTRIBUTING.md, so a green “release” job never meant a full release.
  2. Misleading dry-run — npm publish --dry-run completes without registry authentication (npm only warns). The verify job could pass even when NPM_TOKEN was missing, expired, or read-only.
  3. Real publish fails fast (~2s) — Tag pushes triggered publish-mcp-package, which failed immediately; npm shows the same versions published minutes later by hand (e.g. v1.1.1 workflow failed at 01:07:17Z, @dotcontext/mcp@1.1.1 appeared at 01:23:37Z). That timing matches auth rejection (ENEEDAUTH / E401 / EOTP), not tarball build problems.
  4. No release artifact — The old MCP-only workflow never created a GitHub Release or validated tag ↔ package.json alignment.

What changed

  • Single release job: npm ci → build:packages → smoke:packages → tag/version verification → dry-run all packages → npm whoami on tag pushes → publish all packages → GitHub Release from changelog.
  • New scripts:
    • scripts/verify-release-version.js — tag vX.Y.Z must match root and bundle versions
    • scripts/publish-package-bundles.js — publish order harness → cli → mcp → integrations → pi, skip versions already on npm, optional --provenance
    • scripts/extract-changelog-section.js — release notes for softprops/action-gh-release
  • workflow_dispatch keeps build/smoke/dry-run only (no publish/release).
  • CONTRIBUTING.md documents automated vs manual release paths.

Maintainer action required (repo/npm settings)

Please verify before the next tag (no secrets changed in this PR):

  1. NPM_TOKEN secret — Use an npm Automation token with publish access to all @dotcontext/* packages (classic publish tokens break when 2FA/OTP is required in CI). After merging, run the Release workflow via workflow_dispatch is insufficient for auth proof; use npm whoami locally with the same token class, or rely on the new npm whoami step on the first tag push.
  2. Trusted Publishers (recommended) — For each package (@dotcontext/cli, harness, mcp, integrations, pi), configure npm Trusted Publishers for repository vinilana/dotcontext, workflow file .github/workflows/release.yml, and environment * (or a dedicated environment). This pairs with --provenance enabled on tag pushes. If provenance publish fails, temporarily set job env NPM_PROVENANCE: '0' or fix trusted-publisher linkage.
  3. GitHub Actions permissions — Workflow now requests contents: write and id-token: write for releases and provenance. Ensure repo Settings → Actions → General → Workflow permissions allows GITHUB_TOKEN to create releases (or use a PAT if org policy restricts default token).

Validation

  • npm run test:release-scripts
  • node scripts/verify-release-version.js v1.1.1 (on current tree)
  • DRY_RUN=1 node scripts/publish-package-bundles.js 1.1.1 (skips already-published versions)

Out of scope (per request)

  • No tags pushed, nothing published to npm, no secret rotation.
Open in Web Open in Cursor 

cursoragent and others added 2 commits November 22, 2026 21:06
Replace the MCP-only release workflow with a single job that builds and
smokes all bundles, checks tag/version alignment, publishes packages in
dependency order with npm provenance, skips versions already on npm, and
creates GitHub releases from CHANGELOG sections.

Co-authored-by: Vinicius Lana <viniciuslanadev@gmail.com>
Co-authored-by: Vinicius Lana <viniciuslanadev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants