-
Notifications
You must be signed in to change notification settings - Fork 0
ci(release): pin publish job to a named environment and tag refs #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -296,8 +296,33 @@ jobs: | |
| publish: | ||
| name: Publish to npm (gated, idempotent) | ||
| needs: [resolve-ref, secret-scan, verify] | ||
| # Ref floor for the one job that mints a publishing credential. | ||
| # `resolve-ref` proves the TAG is sdk-v<semver>, exists, and is an ancestor | ||
| # of origin/main -- so the CODE published is always merged code. It says | ||
| # nothing about the RUN's own ref, which is what lands in the OIDC token's | ||
| # `ref` claim and scopes this run's Actions cache: a dispatch from an | ||
| # arbitrary branch would still reach npm under that branch's identity. | ||
| # So: an sdk-v* tag push, a published release, or a dispatch from the | ||
| # default branch (the documented backfill path, already ancestry-anchored) | ||
| # -- and nothing else. A missing `default_branch` makes `format(...)` yield | ||
| # `refs/heads/`, matching no real ref, so the guard fails CLOSED. | ||
| if: >- | ||
| startsWith(github.ref, 'refs/tags/sdk-v') | ||
| || github.event_name == 'release' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The Prompt for AI agents |
||
| || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| # Named environment on the publish job ONLY. It anchors two things this | ||
| # workflow cannot grant itself: the `environment:npm` claim the | ||
| # registry-side trusted publisher is pinned to, and an environment | ||
| # protection rule (required reviewer + tag-only deployment policy) gating | ||
| # the mint. Configuring that environment is an operator act, not this file. | ||
| environment: | ||
| name: npm | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: With the documented tag-only Prompt for AI agents |
||
| url: https://www.npmjs.com/package/@wave-av/sdk | ||
| # `id-token: write` lives here and NOWHERE else; the workflow-level default | ||
| # stays `contents: read`. Do not hoist this to the workflow level -- the | ||
| # sbom job deliberately holds `contents: write` and never the mint. | ||
| permissions: | ||
| id-token: write # mint the OIDC token npm exchanges for a publish credential | ||
| contents: read | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: A manual dispatch whose selected ref is an
sdk-v*tag also passes this clause, even though the guard promises to allow only a tag push. Requiregithub.event_name == 'push'alongsidestartsWith(...)so dispatches cannot bypass the default-branch backfill boundary.Prompt for AI agents