ci(release): verify the packed file list and the provenance attestation - #226
KazeeVortex wants to merge 3 commits into
Conversation
…raith-protocol#45) * perf(stellar): prefilter scans with public view tags * test(stellar): cover legacy view-tag scanner
The publish workflow built and published when the version was new, but never
looked at what it was publishing or at what the registry stored afterwards.
* `files` is `["dist"]`, yet nothing checked the result: a stray `files` edit or
a new top-level directory could start shipping source, tests, API reports or
config to every consumer unnoticed.
* `id-token: write` was already granted, but the publish step did not pass
`--provenance`, and nothing read back whether an attestation was attached.
* Version, changelog and API report alignment were maintained by hand, with no
automated check and no written checklist.
Add three scripts and wire them into CI and the release:
* scripts/verify-pack.mjs runs the real `pnpm pack --dry-run`, rejects any
source/test/docs/script/config/API-report path, requires the dist entry
points and declarations, and checks the tarball name. Prefers pack --json,
falls back to scanning the plain output.
* scripts/verify-provenance.mjs reads the published version's registry metadata
back and fails the run if no attestation is attached.
* scripts/release-check.mjs enforces changelog structure and that an API report
exists for every api-extractor config; an undocumented package version is a
warning, not a failure, since main develops ahead of the released version.
Publish now runs release:check and pack:check before anything is uploaded, then
publishes with --provenance and verifies the attestation afterwards. A new CI job
runs both checks on every PR, so a bad `files` or a stale report fails at review
time instead of at release time. RELEASING.md documents the checklist and the
rollback path.
|
@KazeeVortex Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Auto-retargeted this PR from |
|
Please rebase onto develop and keep this PR focused on release verification. The branch currently includes unrelated batching work and an outdated lockfile, so the checks cannot install dependencies. |
Resolves merge conflicts with wraith-protocol/sdk@develop (base 8ea5dc4) so the pull request can be merged. Auto-merged via the GitHub API.
|
Merge conflict with Pushed merge commit Conflicting file(s) resolved:
The pull request is mergeable again — CI will re-run on the new head. @aratass ready for review and merge when you have a moment. |
Overview
Makes the release verify what it publishes, and makes that verifiable at PR time instead of release time.
The publish workflow was already gated on the version being new, and it already requested
id-token: write— but it never inspected the tarball it uploaded, never passed--provenance, and never read back whether the registry attached an attestation. Version, changelog and API report alignment were maintained by hand with no checklist and nothing enforcing them.Three scripts now cover the gaps, and CI runs two of them on every PR.
Related Issue
Closes #210
Changes
What would be published
[ADD]
scripts/verify-pack.mjs— runs the realpnpm pack --dry-run(nothing is written, no tarball is created) and fails if the packed list contains:src/,test/,tests/,docs/,examples/,scripts/,etc/,audits/,packages/,temp/,.github/,.husky/;package.jsonor a file npm always includes (README,LICENSE,CHANGELOG), which catches lockfiles,tsconfig.json,api-extractor*.json,CLAUDE.md,CONTRIBUTING.mdand friends;package.json, adist/*.cjs|mjs|jsentry point anddist/*.d.tsdeclarations to be present, plus a tarball name matching the package and version.It reads the structured
pnpm pack --dry-run --jsonoutput when available and falls back to scanning the plain output, so a pnpm release cannot silently turn the check into a no-op.[MODIFY]
.github/workflows/publish.yml— runspnpm pack:checkafterpnpm buildand before publish, so a leaking tarball never reaches the registry.[MODIFY]
.github/workflows/ci.yml— newreleasejob runspnpm build && pnpm pack:check && pnpm release:checkon every PR and push, so afileschange or a stale API report fails at review time.Provenance
.github/workflows/publish.ymlpnpm publish --access public --no-git-checks --provenance(theid-token: writepermission was already declared);node scripts/verify-provenance.mjs.scripts/verify-provenance.mjs— reads the published version's registry metadata, retrying for up to ~60s while the registry settles, and fails the run ifdist.attestations.provenanceis absent. Publishing with the flag but never confirming the result is how a silently unattested release goes unnoticed.Release checklist
RELEASING.md— the checklist the issue asks for: semver decision,MIGRATING.mdfor majors, the version bump and the "is it already published" check, moving## Upcomingentries into a released heading, API report refresh, the pack check, what the workflow does, post-publish attestation verification, and the fix-forward/deprecate/unpublish path.scripts/release-check.mjs— automates the parts that are checkable from the repository:## [x.y.z]heading at all; neither an## Upcomingnor a heading for the current version; anapi-extractor*.jsonwhoseapiReportfile is missing or is not a real api-extractor report; config that is not valid JSON;package.jsonversion has no changelog heading. This is reported rather than enforced becausemainlegitimately develops ahead of the released version — right nowpackage.jsonis1.4.5while the changelog's latest released heading is1.5.0. Wiring it in as an error would block unrelated PRs and the publish workflow, so the checklist handles it and CI surfaces it.package.json— addspack:checkandrelease:check.Verification Results
Not claimed:
pnpm pack/pnpm buildwere never run against this repository (no clone), so the first real end-to-end exercise of these scripts against the SDK is this PR's own CI run — that is precisely why they are wired into CI and the release rather than left as manual steps.pnpm pack --dry-runin CIpnpm pack:check(scripts/verify-pack.mjs) runs in the new CIreleasejob and in the publish workflow before upload--provenance;scripts/verify-provenance.mjsreads the registry back and fails the run when no attestation is attachedRELEASING.mdchecklist, plusscripts/release-check.mjsenforcing changelog structure and a report per api-extractor config in CICloses #210