Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/npm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
publish:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 15
timeout-minutes: 30
environment: npm-public
permissions:
contents: read
Expand Down Expand Up @@ -112,11 +112,11 @@ jobs:
run: |
set -euo pipefail
INTEGRITY="sha512-$(openssl dgst -sha512 -binary package.tgz | openssl base64 -A)"
for attempt in {1..10}; do
for attempt in {1..120}; do
STATUS="$(curl --silent --show-error --output "$RUNNER_TEMP/published.json" --write-out '%{http_code}' "https://registry.npmjs.org/@samuelho-dev%2fcoordinator/$VERSION")"
if [ "$STATUS" = 200 ]; then break; fi
if [ "$attempt" = 10 ]; then echo "Registry verification failed (HTTP $STATUS)." >&2; exit 1; fi
sleep 5
if [ "$STATUS" != 404 ] || [ "$attempt" = 120 ]; then echo "Registry verification failed (HTTP $STATUS)." >&2; exit 1; fi
sleep 10
done
jq -e --arg version "$VERSION" --arg integrity "$INTEGRITY" '.name == "@samuelho-dev/coordinator" and .version == $version and .dist.integrity == $integrity' "$RUNNER_TEMP/published.json"
printf 'Published and verified `@samuelho-dev/coordinator@%s` under `beta` from CI `%s`, source `%s`, SHA256 `%s`. No rebuild or visibility change.\n' "$VERSION" '${{ inputs.ci_run_id }}' "$SHA" "$(jq -r .archiveSha256 npm.json)" >> "$GITHUB_STEP_SUMMARY"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ Release gaps and constraints:
- Publish only the accepted tarball from successful current-main CI. Apply the [release workflow's](.github/workflows/npm-release.yaml) source/run/attempt, required-job, unique-unexpired-artifact, manifest/repository, normalized source-contract, SHA256 and unused-version checks. Do not rebuild, repack a dirty checkout or create a dummy bootstrap version. Explicitly publish that archive with `--ignore-scripts --access public --tag beta --registry=https://registry.npmjs.org`; an interactive first publication has no hosted npm provenance.
- For later releases, configure [npm's trusted publisher](https://docs.npmjs.com/trusted-publishers/) for GitHub owner `samuelho-dev`, repository `coordinator`, workflow `npm-release.yaml`, environment `npm-public`, with direct publishing allowed. Protect that GitHub environment with maintainers/reviewers and main-only restrictions; naming it in YAML does not create those rules. The hosted OIDC workflow publishes the verified archive with provenance, without an npm token fallback, then checks the registry's exact version and SHA-512 integrity against that archive. A failed post-publication check requires investigation; it does not undo a successful publish.

Registry verification allows up to 120 checks, ten seconds apart, for npm processing. Publishing is not retried; an integrity mismatch still fails the release.


## Internal contract

Expand Down
Loading