From bdc858fe20fea89c9410c36b5a1013cca2ec6834 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 3 Dec 2026 06:44:11 -0800 Subject: [PATCH 1/7] Upload the PyPI Default Leaf's Wheel and Sdist as a Release Asset The hub default PyPI leaf uploaded no release-asset artifact, so a PyPI caller needed its own build-pypi hook only to attach the package files to the GitHub release. The leaf now uploads release-asset--pypi unzipped, gated on smoke being false, which the github-release job already collects with merge-multiple. The contract text no longer says PyPI contributes no release asset, and a test holds both default leaves to the name pattern, the smoke gate, and retention-days 1. Part of #4609 Co-Authored-By: Claude Sonnet 5.5 --- .../references/release-publish-mechanics.md | 8 +++--- .../references/architecture.md | 4 +-- .../references/d-guarantees.md | 4 +-- .../branching-and-release-model | 2 +- .../.source-digests/workflow-ci-contract | 2 +- .../references/release-publish-mechanics.md | 8 +++--- .../references/architecture.md | 4 +-- .../references/d-guarantees.md | 4 +-- .github/actions/pypi-build-default/action.yml | 14 +++++++++- .../references/release-publish-mechanics.md | 8 +++--- .../references/architecture.md | 4 +-- .../references/d-guarantees.md | 4 +-- .github/workflows/build-release-task.yml | 9 ++++--- WORKFLOW.md | 10 +++---- tests/test_release_guards.py | 27 +++++++++++++++++++ 15 files changed, 79 insertions(+), 33 deletions(-) diff --git a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md index b3af6488d..c47e74394 100644 --- a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -61,11 +61,13 @@ Pick by where each artifact *goes*, not by language: build-nuget hook uploads a `nuget-build-` artifact for a separate `publish-nuget` job in the caller's own `publish-release.yml`. That job authenticates through `NuGet/login` and therefore carries `id-token: write` (plus `actions: write` to delete the artifact it consumed). The hook - *also* uploads a `release-asset-*` (.7z) for the GitHub release. PyPI is the same shape: the build-pypi hook only builds and uploads the - `pypi-build-` artifact. The separate `publish-pypi` job in the caller's own + *also* uploads a `release-asset-*` (.7z) for the GitHub release. + PyPI is the same shape: the hub default leaf uploads the `pypi-build-` artifact and a + `release-asset--pypi` carrying the wheel and sdist. + The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload, behind an `environment: pypi` gate and with `skip-existing: true`. The `id-token: write` permission is granted only at that - one entry point. PyPI contributes **no** `release-asset-*`. + one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes **no** `release-asset-*`. The image set comes from a docker-prepare hook (the hub default emits the diff --git a/.agents/skills/workflow-ci-contract/references/architecture.md b/.agents/skills/workflow-ci-contract/references/architecture.md index 07d73c83e..c1c3e0452 100644 --- a/.agents/skills/workflow-ci-contract/references/architecture.md +++ b/.agents/skills/workflow-ci-contract/references/architecture.md @@ -102,10 +102,10 @@ flowchart TD Pick each output's path by **where the artifact goes**: - **File on the GitHub release** (zip, binary, packaged library): one leaf per output uploading `release-asset--`. For a repo calling the hub-hosted task, the path is instead the files its `build-release-asset` hook writes, which the task uploads as one such artifact. The repo keeps `expect_release_assets: true` (its default). -- **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's leaf also uploads a `release-asset-*` carrying the package, and PyPI contributes none. +- **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's and PyPI's default leaves also upload a `release-asset-*` carrying the package files. - **Image-registry push** (Docker): the leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes no `release-asset-*`. The arm64 emulation is reserved for the released image. - **Filesystem on a host the project owns** (a static site, a config tree): the leaf builds the tree and ships it to the host. It contributes no `release-asset-*`. The transport is the repo's own. The contract fixes the rest. The deploy is a **separate `workflow_dispatch`** from the release, so a redeploy of an unchanged commit mints no tag. A host rebuild, a rollback, or proving a branch on a non-production environment then costs nothing. Its credentials come from a **per-environment GitHub Environment** rather than the repository secret store. The deploy also ends by asserting **what the host serves** rather than the transport's exit status (D4.6). Retention at the destination is bounded by a declared count, with one side recorded as owning the prune. That side is the deploy where its credential can observe the destination, and the host where that credential is deliberately write-only (D5.6). -- **No file target via the release task** (Docker-only, PyPI-only, source-only): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). +- **No file target** (Docker-only, source-only, or PyPI with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). `WORKFLOW.md` section 3 keeps the architecture. The `workflow-ci-contract` Skill carries this section whole as a generated include, at `.agents/skills/workflow-ci-contract/references/architecture.md` in the hub. That path is not a repo-relative link, since it is hub-local and not carried into every fleet repo. diff --git a/.agents/skills/workflow-ci-contract/references/d-guarantees.md b/.agents/skills/workflow-ci-contract/references/d-guarantees.md index e4a37f852..9fc7ac988 100644 --- a/.agents/skills/workflow-ci-contract/references/d-guarantees.md +++ b/.agents/skills/workflow-ci-contract/references/d-guarantees.md @@ -39,7 +39,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output - **D4.1 Gated single-branch publish.** Output: PRs smoke-test and publish nothing. A **human merge never auto-publishes**. A `plan` job (`publish-plan-task.yml`) decides once. A job downstream of it either gates on the plan's outputs or inherits the skip through `needs:`. A gate on an output compares it against `'true'` rather than testing it bare, since a job output is always a string. A publish runs on a **code-affecting bot push to `main`**, gated to the codegen App / Dependabot `github.actor`. On that trigger, an Actions-only bump matches no release path and publishes nothing. A publish also runs on a **dispatch** of `main`/`develop`, or on a **main-only weekly schedule** (Docker). A source-only repo publishes on dispatch only. The plan reports every `schedule` as a publish, so a publisher with no `push` trigger whose schedule retests and never publishes gates its release itself. Each of its jobs calling `build-release-task.yml` carries `github.event_name == 'workflow_dispatch'` as an `&&` term of its job-level `if:` holding no `||` or negated group. Each run builds one branch. The D4.7 supersede dispatch has one accepted, bounded window that publishes without the allowlist check. - **D4.2 Tag the built commit.** Output: the release `target_commitish` is the built commit's SHA (NBGV's `GitCommitId`), never a branch name or a separately re-resolved ref. *Prevents: the tag landing on the default branch instead of the built tree.* -- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only, PyPI-only, and source-only repos. A NuGet target is not among them, since its leaf uploads a `release-asset-*` carrying the package, so a NuGet-only caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. +- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. - **D4.4 No-op republish.** Input: a re-run whose version is unchanged, on a schedule or push trigger. Output: no second release is cut, because the release-create step is skipped when `gh release view` finds a release for the tag. The paired asset-delete is skipped with it. A **dispatch** re-run refreshes the release instead and runs that delete with it. That is why a dispatch-only publisher records this item's skip leg as unreachable rather than failed. Package-registry pushes are no-ops. The NuGet/PyPI publish steps are **not** statically gated on existence. They run and the **server** dedupes (`dotnet nuget push --skip-duplicate` turns a 409 into success, and PyPI does the same under `skip-existing: true`). **Docker always re-pushes** the image (base-image refresh), independently of the release-create skip, within the same run. *Prevents: duplicate releases and wasted pushes.* - **D4.5 A build failure blocks every publish target, within the Docker limit below.** Input: a real publish where one enabled build fails. Output: nothing publishes. The limit applies where a Docker target builds a shared base or more than one image. Its task then pushes the base and each image leg as it builds. So a leg failing after the base or a sibling leg pushed leaves those images in the registry with no release. `github-release` needs every build and carries the same `!failure() && !cancelled()` guard the terminal registry pusher (Docker) does. Without that guard, the implicit `success()` would skip both on every run that disables a target, rather than only on a failed one. A failed build therefore skips the release (no tag, no release). Docker, which needs every other build, skips with it (no image push). By contrast, a **disabled** target, skipped rather than failed, still lets docker push. A package target's separate publish job needs its own gate for the same reason, since it sits outside the `github-release` and Docker `needs:` chains. That gate is that it `needs:` the release-task call, so a failed build skips it with the rest. The push itself is what no gate can cover, because it runs after the whole release task and therefore after `github-release`. It runs there for the trusted-publishing reason `WORKFLOW.md` section 3's "Output Seam by Destination" package-registry bullet gives. So a rejected token exchange, a registry outage, or a trusted-publishing policy naming the wrong workflow file leaves a published release and tag. That release and tag are for a version that never reached the registry. The recovery is a re-dispatch or a full re-run rather than a cleanup. **A full re-run is always available inside its window and is the only route once the branch tip has moved.** The `Re-run failed jobs` shortcut is not a third route here, D5.2's delete having already removed the artifact it would download. `GOVERNANCE.md` "Release Model", and the skill it routes to, carry the mechanics of each route, how to choose, and the window. *Prevents: a partial publish, e.g. a Docker image pushed while .NET publish failed and no release was cut.* - **D4.6 Deploy verification names the release.** Input: a deploy to a filesystem on a host the project owns that completes without error. Output: a check against the running host asserts **which release is answering**, not merely that it answers. The artifact stamps its own version into the configuration it ships, and the check compares that against the version just installed. The check **waits for convergence to a bounded timeout** rather than sampling once. That is because content goes live the instant a pointer moves, while server rules wait on an asynchronous reload. The same check asserts **which environment** answered. That is because several environments serve a byte-identical artifact, and a proxy rule aimed at the wrong one answers healthily under the right hostname. An unreachable host is reported distinctly from an HTTP status. *Prevents: a green deploy over a host still serving the previous release's configuration, and a URL contract checked against the wrong environment. It also prevents a dead config watcher read as a routing fault.* @@ -56,7 +56,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output ### D6 - Seam / Architecture Conformance -- **D6.1 Pattern handoff.** Output: the release job downloads by `pattern:`/`merge-multiple:`, not `artifact-ids:`. **File** targets upload `release-asset--`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `` with `build-release-asset`. A target contributing no file to the release (Docker, PyPI) uploads no `release-asset-*` of its own, per D4.3, whatever other transfer artifact it uploads. The `pattern:` download is canonical for a single-target repo too, which does not special-case itself to `artifact-ids:`. +- **D6.1 Pattern handoff.** Output: the release job downloads by `pattern:`/`merge-multiple:`, not `artifact-ids:`. **File** targets upload `release-asset--`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `` with `build-release-asset`. A target contributing no file to the release (Docker) uploads no `release-asset-*` of its own, per D4.3, whatever other transfer artifact it uploads. The `pattern:` download is canonical for a single-target repo too, which does not special-case itself to `artifact-ids:`. - **D6.2 Branch drives config.** Output: a called workflow's branch-derived config reads `inputs.branch`, never `github.ref_name`. - **D6.3 Branch-named artifacts.** Output: every artifact name carries the branch, so a branch's artifacts do not collide with another branch's. - **D6.4 Target add/drop is consistent.** Output: adding or dropping a target updates **all** of the following. The list is the `enable_` value the publisher passes to the release task, and the publisher's `on.push.paths` entries where it carries a `push` trigger. The list continues with the `changes` paths-filter entry + output and the `smoke-build` enable-forward. The list includes `expect_release_assets` where the change adds the first file target or drops the last (D4.3). For a package target, the list also includes the separate `publish-` job. A repo owning its release task also updates the target's build job there, `build-` or `dotnet-publish` for the .NET target. It also updates the target's `github-release` and `build-docker` `needs:` entries. Everything in the `github-release` job **except its `needs:` list** stays verbatim, and so does the version and publish-plan logic. "Verbatim" never reaches the surfaces this item requires editing, that `needs:` list, the release task's job list, and the paths-filter among them. *Prevents: a partial subset that startup-fails on a missing leaf or never smoke-builds a target.* diff --git a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model index d54768412..4e18dd2aa 100644 --- a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model +++ b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model @@ -1 +1 @@ -c18b4ff8c13f0ac7 +a510e6b2971dc678 diff --git a/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract b/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract index fd526bce3..d98d667ee 100644 --- a/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract +++ b/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract @@ -1 +1 @@ -23c6a153a42f8126 +2469cf083b301a35 diff --git a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md index b3af6488d..c47e74394 100644 --- a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -61,11 +61,13 @@ Pick by where each artifact *goes*, not by language: build-nuget hook uploads a `nuget-build-` artifact for a separate `publish-nuget` job in the caller's own `publish-release.yml`. That job authenticates through `NuGet/login` and therefore carries `id-token: write` (plus `actions: write` to delete the artifact it consumed). The hook - *also* uploads a `release-asset-*` (.7z) for the GitHub release. PyPI is the same shape: the build-pypi hook only builds and uploads the - `pypi-build-` artifact. The separate `publish-pypi` job in the caller's own + *also* uploads a `release-asset-*` (.7z) for the GitHub release. + PyPI is the same shape: the hub default leaf uploads the `pypi-build-` artifact and a + `release-asset--pypi` carrying the wheel and sdist. + The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload, behind an `environment: pypi` gate and with `skip-existing: true`. The `id-token: write` permission is granted only at that - one entry point. PyPI contributes **no** `release-asset-*`. + one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes **no** `release-asset-*`. The image set comes from a docker-prepare hook (the hub default emits the diff --git a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md index 07d73c83e..c1c3e0452 100644 --- a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md +++ b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md @@ -102,10 +102,10 @@ flowchart TD Pick each output's path by **where the artifact goes**: - **File on the GitHub release** (zip, binary, packaged library): one leaf per output uploading `release-asset--`. For a repo calling the hub-hosted task, the path is instead the files its `build-release-asset` hook writes, which the task uploads as one such artifact. The repo keeps `expect_release_assets: true` (its default). -- **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's leaf also uploads a `release-asset-*` carrying the package, and PyPI contributes none. +- **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's and PyPI's default leaves also upload a `release-asset-*` carrying the package files. - **Image-registry push** (Docker): the leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes no `release-asset-*`. The arm64 emulation is reserved for the released image. - **Filesystem on a host the project owns** (a static site, a config tree): the leaf builds the tree and ships it to the host. It contributes no `release-asset-*`. The transport is the repo's own. The contract fixes the rest. The deploy is a **separate `workflow_dispatch`** from the release, so a redeploy of an unchanged commit mints no tag. A host rebuild, a rollback, or proving a branch on a non-production environment then costs nothing. Its credentials come from a **per-environment GitHub Environment** rather than the repository secret store. The deploy also ends by asserting **what the host serves** rather than the transport's exit status (D4.6). Retention at the destination is bounded by a declared count, with one side recorded as owning the prune. That side is the deploy where its credential can observe the destination, and the host where that credential is deliberately write-only (D5.6). -- **No file target via the release task** (Docker-only, PyPI-only, source-only): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). +- **No file target** (Docker-only, source-only, or PyPI with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). `WORKFLOW.md` section 3 keeps the architecture. The `workflow-ci-contract` Skill carries this section whole as a generated include, at `.agents/skills/workflow-ci-contract/references/architecture.md` in the hub. That path is not a repo-relative link, since it is hub-local and not carried into every fleet repo. diff --git a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md index e4a37f852..9fc7ac988 100644 --- a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md +++ b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md @@ -39,7 +39,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output - **D4.1 Gated single-branch publish.** Output: PRs smoke-test and publish nothing. A **human merge never auto-publishes**. A `plan` job (`publish-plan-task.yml`) decides once. A job downstream of it either gates on the plan's outputs or inherits the skip through `needs:`. A gate on an output compares it against `'true'` rather than testing it bare, since a job output is always a string. A publish runs on a **code-affecting bot push to `main`**, gated to the codegen App / Dependabot `github.actor`. On that trigger, an Actions-only bump matches no release path and publishes nothing. A publish also runs on a **dispatch** of `main`/`develop`, or on a **main-only weekly schedule** (Docker). A source-only repo publishes on dispatch only. The plan reports every `schedule` as a publish, so a publisher with no `push` trigger whose schedule retests and never publishes gates its release itself. Each of its jobs calling `build-release-task.yml` carries `github.event_name == 'workflow_dispatch'` as an `&&` term of its job-level `if:` holding no `||` or negated group. Each run builds one branch. The D4.7 supersede dispatch has one accepted, bounded window that publishes without the allowlist check. - **D4.2 Tag the built commit.** Output: the release `target_commitish` is the built commit's SHA (NBGV's `GitCommitId`), never a branch name or a separately re-resolved ref. *Prevents: the tag landing on the default branch instead of the built tree.* -- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only, PyPI-only, and source-only repos. A NuGet target is not among them, since its leaf uploads a `release-asset-*` carrying the package, so a NuGet-only caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. +- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. - **D4.4 No-op republish.** Input: a re-run whose version is unchanged, on a schedule or push trigger. Output: no second release is cut, because the release-create step is skipped when `gh release view` finds a release for the tag. The paired asset-delete is skipped with it. A **dispatch** re-run refreshes the release instead and runs that delete with it. That is why a dispatch-only publisher records this item's skip leg as unreachable rather than failed. Package-registry pushes are no-ops. The NuGet/PyPI publish steps are **not** statically gated on existence. They run and the **server** dedupes (`dotnet nuget push --skip-duplicate` turns a 409 into success, and PyPI does the same under `skip-existing: true`). **Docker always re-pushes** the image (base-image refresh), independently of the release-create skip, within the same run. *Prevents: duplicate releases and wasted pushes.* - **D4.5 A build failure blocks every publish target, within the Docker limit below.** Input: a real publish where one enabled build fails. Output: nothing publishes. The limit applies where a Docker target builds a shared base or more than one image. Its task then pushes the base and each image leg as it builds. So a leg failing after the base or a sibling leg pushed leaves those images in the registry with no release. `github-release` needs every build and carries the same `!failure() && !cancelled()` guard the terminal registry pusher (Docker) does. Without that guard, the implicit `success()` would skip both on every run that disables a target, rather than only on a failed one. A failed build therefore skips the release (no tag, no release). Docker, which needs every other build, skips with it (no image push). By contrast, a **disabled** target, skipped rather than failed, still lets docker push. A package target's separate publish job needs its own gate for the same reason, since it sits outside the `github-release` and Docker `needs:` chains. That gate is that it `needs:` the release-task call, so a failed build skips it with the rest. The push itself is what no gate can cover, because it runs after the whole release task and therefore after `github-release`. It runs there for the trusted-publishing reason `WORKFLOW.md` section 3's "Output Seam by Destination" package-registry bullet gives. So a rejected token exchange, a registry outage, or a trusted-publishing policy naming the wrong workflow file leaves a published release and tag. That release and tag are for a version that never reached the registry. The recovery is a re-dispatch or a full re-run rather than a cleanup. **A full re-run is always available inside its window and is the only route once the branch tip has moved.** The `Re-run failed jobs` shortcut is not a third route here, D5.2's delete having already removed the artifact it would download. `GOVERNANCE.md` "Release Model", and the skill it routes to, carry the mechanics of each route, how to choose, and the window. *Prevents: a partial publish, e.g. a Docker image pushed while .NET publish failed and no release was cut.* - **D4.6 Deploy verification names the release.** Input: a deploy to a filesystem on a host the project owns that completes without error. Output: a check against the running host asserts **which release is answering**, not merely that it answers. The artifact stamps its own version into the configuration it ships, and the check compares that against the version just installed. The check **waits for convergence to a bounded timeout** rather than sampling once. That is because content goes live the instant a pointer moves, while server rules wait on an asynchronous reload. The same check asserts **which environment** answered. That is because several environments serve a byte-identical artifact, and a proxy rule aimed at the wrong one answers healthily under the right hostname. An unreachable host is reported distinctly from an HTTP status. *Prevents: a green deploy over a host still serving the previous release's configuration, and a URL contract checked against the wrong environment. It also prevents a dead config watcher read as a routing fault.* @@ -56,7 +56,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output ### D6 - Seam / Architecture Conformance -- **D6.1 Pattern handoff.** Output: the release job downloads by `pattern:`/`merge-multiple:`, not `artifact-ids:`. **File** targets upload `release-asset--`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `` with `build-release-asset`. A target contributing no file to the release (Docker, PyPI) uploads no `release-asset-*` of its own, per D4.3, whatever other transfer artifact it uploads. The `pattern:` download is canonical for a single-target repo too, which does not special-case itself to `artifact-ids:`. +- **D6.1 Pattern handoff.** Output: the release job downloads by `pattern:`/`merge-multiple:`, not `artifact-ids:`. **File** targets upload `release-asset--`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `` with `build-release-asset`. A target contributing no file to the release (Docker) uploads no `release-asset-*` of its own, per D4.3, whatever other transfer artifact it uploads. The `pattern:` download is canonical for a single-target repo too, which does not special-case itself to `artifact-ids:`. - **D6.2 Branch drives config.** Output: a called workflow's branch-derived config reads `inputs.branch`, never `github.ref_name`. - **D6.3 Branch-named artifacts.** Output: every artifact name carries the branch, so a branch's artifacts do not collide with another branch's. - **D6.4 Target add/drop is consistent.** Output: adding or dropping a target updates **all** of the following. The list is the `enable_` value the publisher passes to the release task, and the publisher's `on.push.paths` entries where it carries a `push` trigger. The list continues with the `changes` paths-filter entry + output and the `smoke-build` enable-forward. The list includes `expect_release_assets` where the change adds the first file target or drops the last (D4.3). For a package target, the list also includes the separate `publish-` job. A repo owning its release task also updates the target's build job there, `build-` or `dotnet-publish` for the .NET target. It also updates the target's `github-release` and `build-docker` `needs:` entries. Everything in the `github-release` job **except its `needs:` list** stays verbatim, and so does the version and publish-plan logic. "Verbatim" never reaches the surfaces this item requires editing, that `needs:` list, the release task's job list, and the paths-filter among them. *Prevents: a partial subset that startup-fails on a missing leaf or never smoke-builds a target.* diff --git a/.github/actions/pypi-build-default/action.yml b/.github/actions/pypi-build-default/action.yml index 3670d287c..3a5e02fa4 100644 --- a/.github/actions/pypi-build-default/action.yml +++ b/.github/actions/pypi-build-default/action.yml @@ -6,7 +6,7 @@ inputs: description: Logical branch driving the PEP 440 version. develop gives a .dev0 prerelease, else a plain release. required: true smoke: - description: Smoke mode skips the build-artifact upload, since nothing would consume it. + description: Smoke mode skips the build-artifact upload and the release-asset upload, since nothing would consume them. required: false default: 'false' semver2: @@ -134,3 +134,15 @@ runs: if-no-files-found: error # Consumed within the run by the caller stub's publish-pypi job, so minimize artifact storage. retention-days: 1 + + # GitHub-release asset, uploaded under the release-asset-- pattern the github-release job collects. + # The wheel and sdist go up unzipped, so the release attaches the files directly, since the job downloads with merge-multiple. + - name: Upload release asset step + if: ${{ inputs.smoke != 'true' }} + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: release-asset-${{ inputs.branch }}-pypi + path: ${{ inputs.project-dir }}/dist/* + if-no-files-found: error + # Consumed within the run by the github-release job, so minimize artifact storage. + retention-days: 1 diff --git a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md index b3af6488d..c47e74394 100644 --- a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -61,11 +61,13 @@ Pick by where each artifact *goes*, not by language: build-nuget hook uploads a `nuget-build-` artifact for a separate `publish-nuget` job in the caller's own `publish-release.yml`. That job authenticates through `NuGet/login` and therefore carries `id-token: write` (plus `actions: write` to delete the artifact it consumed). The hook - *also* uploads a `release-asset-*` (.7z) for the GitHub release. PyPI is the same shape: the build-pypi hook only builds and uploads the - `pypi-build-` artifact. The separate `publish-pypi` job in the caller's own + *also* uploads a `release-asset-*` (.7z) for the GitHub release. + PyPI is the same shape: the hub default leaf uploads the `pypi-build-` artifact and a + `release-asset--pypi` carrying the wheel and sdist. + The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload, behind an `environment: pypi` gate and with `skip-existing: true`. The `id-token: write` permission is granted only at that - one entry point. PyPI contributes **no** `release-asset-*`. + one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes **no** `release-asset-*`. The image set comes from a docker-prepare hook (the hub default emits the diff --git a/.github/skills/workflow-ci-contract/references/architecture.md b/.github/skills/workflow-ci-contract/references/architecture.md index 07d73c83e..c1c3e0452 100644 --- a/.github/skills/workflow-ci-contract/references/architecture.md +++ b/.github/skills/workflow-ci-contract/references/architecture.md @@ -102,10 +102,10 @@ flowchart TD Pick each output's path by **where the artifact goes**: - **File on the GitHub release** (zip, binary, packaged library): one leaf per output uploading `release-asset--`. For a repo calling the hub-hosted task, the path is instead the files its `build-release-asset` hook writes, which the task uploads as one such artifact. The repo keeps `expect_release_assets: true` (its default). -- **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's leaf also uploads a `release-asset-*` carrying the package, and PyPI contributes none. +- **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's and PyPI's default leaves also upload a `release-asset-*` carrying the package files. - **Image-registry push** (Docker): the leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes no `release-asset-*`. The arm64 emulation is reserved for the released image. - **Filesystem on a host the project owns** (a static site, a config tree): the leaf builds the tree and ships it to the host. It contributes no `release-asset-*`. The transport is the repo's own. The contract fixes the rest. The deploy is a **separate `workflow_dispatch`** from the release, so a redeploy of an unchanged commit mints no tag. A host rebuild, a rollback, or proving a branch on a non-production environment then costs nothing. Its credentials come from a **per-environment GitHub Environment** rather than the repository secret store. The deploy also ends by asserting **what the host serves** rather than the transport's exit status (D4.6). Retention at the destination is bounded by a declared count, with one side recorded as owning the prune. That side is the deploy where its credential can observe the destination, and the host where that credential is deliberately write-only (D5.6). -- **No file target via the release task** (Docker-only, PyPI-only, source-only): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). +- **No file target** (Docker-only, source-only, or PyPI with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). `WORKFLOW.md` section 3 keeps the architecture. The `workflow-ci-contract` Skill carries this section whole as a generated include, at `.agents/skills/workflow-ci-contract/references/architecture.md` in the hub. That path is not a repo-relative link, since it is hub-local and not carried into every fleet repo. diff --git a/.github/skills/workflow-ci-contract/references/d-guarantees.md b/.github/skills/workflow-ci-contract/references/d-guarantees.md index e4a37f852..9fc7ac988 100644 --- a/.github/skills/workflow-ci-contract/references/d-guarantees.md +++ b/.github/skills/workflow-ci-contract/references/d-guarantees.md @@ -39,7 +39,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output - **D4.1 Gated single-branch publish.** Output: PRs smoke-test and publish nothing. A **human merge never auto-publishes**. A `plan` job (`publish-plan-task.yml`) decides once. A job downstream of it either gates on the plan's outputs or inherits the skip through `needs:`. A gate on an output compares it against `'true'` rather than testing it bare, since a job output is always a string. A publish runs on a **code-affecting bot push to `main`**, gated to the codegen App / Dependabot `github.actor`. On that trigger, an Actions-only bump matches no release path and publishes nothing. A publish also runs on a **dispatch** of `main`/`develop`, or on a **main-only weekly schedule** (Docker). A source-only repo publishes on dispatch only. The plan reports every `schedule` as a publish, so a publisher with no `push` trigger whose schedule retests and never publishes gates its release itself. Each of its jobs calling `build-release-task.yml` carries `github.event_name == 'workflow_dispatch'` as an `&&` term of its job-level `if:` holding no `||` or negated group. Each run builds one branch. The D4.7 supersede dispatch has one accepted, bounded window that publishes without the allowlist check. - **D4.2 Tag the built commit.** Output: the release `target_commitish` is the built commit's SHA (NBGV's `GitCommitId`), never a branch name or a separately re-resolved ref. *Prevents: the tag landing on the default branch instead of the built tree.* -- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only, PyPI-only, and source-only repos. A NuGet target is not among them, since its leaf uploads a `release-asset-*` carrying the package, so a NuGet-only caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. +- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. - **D4.4 No-op republish.** Input: a re-run whose version is unchanged, on a schedule or push trigger. Output: no second release is cut, because the release-create step is skipped when `gh release view` finds a release for the tag. The paired asset-delete is skipped with it. A **dispatch** re-run refreshes the release instead and runs that delete with it. That is why a dispatch-only publisher records this item's skip leg as unreachable rather than failed. Package-registry pushes are no-ops. The NuGet/PyPI publish steps are **not** statically gated on existence. They run and the **server** dedupes (`dotnet nuget push --skip-duplicate` turns a 409 into success, and PyPI does the same under `skip-existing: true`). **Docker always re-pushes** the image (base-image refresh), independently of the release-create skip, within the same run. *Prevents: duplicate releases and wasted pushes.* - **D4.5 A build failure blocks every publish target, within the Docker limit below.** Input: a real publish where one enabled build fails. Output: nothing publishes. The limit applies where a Docker target builds a shared base or more than one image. Its task then pushes the base and each image leg as it builds. So a leg failing after the base or a sibling leg pushed leaves those images in the registry with no release. `github-release` needs every build and carries the same `!failure() && !cancelled()` guard the terminal registry pusher (Docker) does. Without that guard, the implicit `success()` would skip both on every run that disables a target, rather than only on a failed one. A failed build therefore skips the release (no tag, no release). Docker, which needs every other build, skips with it (no image push). By contrast, a **disabled** target, skipped rather than failed, still lets docker push. A package target's separate publish job needs its own gate for the same reason, since it sits outside the `github-release` and Docker `needs:` chains. That gate is that it `needs:` the release-task call, so a failed build skips it with the rest. The push itself is what no gate can cover, because it runs after the whole release task and therefore after `github-release`. It runs there for the trusted-publishing reason `WORKFLOW.md` section 3's "Output Seam by Destination" package-registry bullet gives. So a rejected token exchange, a registry outage, or a trusted-publishing policy naming the wrong workflow file leaves a published release and tag. That release and tag are for a version that never reached the registry. The recovery is a re-dispatch or a full re-run rather than a cleanup. **A full re-run is always available inside its window and is the only route once the branch tip has moved.** The `Re-run failed jobs` shortcut is not a third route here, D5.2's delete having already removed the artifact it would download. `GOVERNANCE.md` "Release Model", and the skill it routes to, carry the mechanics of each route, how to choose, and the window. *Prevents: a partial publish, e.g. a Docker image pushed while .NET publish failed and no release was cut.* - **D4.6 Deploy verification names the release.** Input: a deploy to a filesystem on a host the project owns that completes without error. Output: a check against the running host asserts **which release is answering**, not merely that it answers. The artifact stamps its own version into the configuration it ships, and the check compares that against the version just installed. The check **waits for convergence to a bounded timeout** rather than sampling once. That is because content goes live the instant a pointer moves, while server rules wait on an asynchronous reload. The same check asserts **which environment** answered. That is because several environments serve a byte-identical artifact, and a proxy rule aimed at the wrong one answers healthily under the right hostname. An unreachable host is reported distinctly from an HTTP status. *Prevents: a green deploy over a host still serving the previous release's configuration, and a URL contract checked against the wrong environment. It also prevents a dead config watcher read as a routing fault.* @@ -56,7 +56,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output ### D6 - Seam / Architecture Conformance -- **D6.1 Pattern handoff.** Output: the release job downloads by `pattern:`/`merge-multiple:`, not `artifact-ids:`. **File** targets upload `release-asset--`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `` with `build-release-asset`. A target contributing no file to the release (Docker, PyPI) uploads no `release-asset-*` of its own, per D4.3, whatever other transfer artifact it uploads. The `pattern:` download is canonical for a single-target repo too, which does not special-case itself to `artifact-ids:`. +- **D6.1 Pattern handoff.** Output: the release job downloads by `pattern:`/`merge-multiple:`, not `artifact-ids:`. **File** targets upload `release-asset--`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `` with `build-release-asset`. A target contributing no file to the release (Docker) uploads no `release-asset-*` of its own, per D4.3, whatever other transfer artifact it uploads. The `pattern:` download is canonical for a single-target repo too, which does not special-case itself to `artifact-ids:`. - **D6.2 Branch drives config.** Output: a called workflow's branch-derived config reads `inputs.branch`, never `github.ref_name`. - **D6.3 Branch-named artifacts.** Output: every artifact name carries the branch, so a branch's artifacts do not collide with another branch's. - **D6.4 Target add/drop is consistent.** Output: adding or dropping a target updates **all** of the following. The list is the `enable_` value the publisher passes to the release task, and the publisher's `on.push.paths` entries where it carries a `push` trigger. The list continues with the `changes` paths-filter entry + output and the `smoke-build` enable-forward. The list includes `expect_release_assets` where the change adds the first file target or drops the last (D4.3). For a package target, the list also includes the separate `publish-` job. A repo owning its release task also updates the target's build job there, `build-` or `dotnet-publish` for the .NET target. It also updates the target's `github-release` and `build-docker` `needs:` entries. Everything in the `github-release` job **except its `needs:` list** stays verbatim, and so does the version and publish-plan logic. "Verbatim" never reaches the surfaces this item requires editing, that `needs:` list, the release task's job list, and the paths-filter among them. *Prevents: a partial subset that startup-fails on a missing leaf or never smoke-builds a target.* diff --git a/.github/workflows/build-release-task.yml b/.github/workflows/build-release-task.yml index e9dd80999..e83a99d73 100644 --- a/.github/workflows/build-release-task.yml +++ b/.github/workflows/build-release-task.yml @@ -4,7 +4,7 @@ name: Build project release task # NBGV runs once in get-version and threads the version to every target. # The validate-release job gates branch<->version consistency once before any build or publish. # The github-release job is verbatim in shape: pattern download, exists gate, target_commitish, consume-then-delete. -# The expect_release_assets input collapses the fleet's three no-asset release shapes (Docker-only, PyPI-only, source-only) into one flag. +# The expect_release_assets input collapses the fleet's no-asset release shapes (Docker-only, source-only, a PyPI caller whose own hook uploads no asset) into one flag. # # Each build target uses a caller hook or the hub default for that target. # The one exception is build-release-asset, a file target the hub cannot know, whose caller hook is required. @@ -63,8 +63,9 @@ on: required: false type: boolean default: false - # Set false for a repo that produces no release-asset-* files, such as a Docker-only, PyPI-only, or source-only one. - # A NuGet caller keeps the default, since the nuget-build hook uploads a release-asset--nuget carrying the package. + # Set false for a repo that produces no release-asset-* files, such as a Docker-only or source-only one. + # A NuGet or PyPI caller on the hub default leaf keeps the default, since that leaf uploads a release-asset--nuget or -pypi carrying the package files. + # A PyPI caller whose own build-pypi hook uploads no release-asset-* sets it false. # The release is then just the tag + source zip + README + LICENSE. # The artifact download is skipped and the unmatched-files guard relaxes. expect_release_assets: @@ -487,7 +488,7 @@ jobs: # A skipped needs job still lets this job run, since it only needs a real, non-smoke publish. # The release step guards fail_on_unmatched_files: true, so at least one release-asset-* must match. # A repo that drops every file-producing target relaxes that guard. - # A Docker-only or PyPI-only repo is the case, its release carrying only the source zip + README + LICENSE. + # A Docker-only repo is the case, its release carrying only the source zip + README + LICENSE. - name: Download release asset artifacts step if: ${{ inputs.expect_release_assets }} uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 diff --git a/WORKFLOW.md b/WORKFLOW.md index 6bfd15ce0..f03496ff5 100644 --- a/WORKFLOW.md +++ b/WORKFLOW.md @@ -125,10 +125,10 @@ flowchart TD Pick each output's path by **where the artifact goes**: - **File on the GitHub release** (zip, binary, packaged library): one leaf per output uploading `release-asset--`. For a repo calling the hub-hosted task, the path is instead the files its `build-release-asset` hook writes, which the task uploads as one such artifact. The repo keeps `expect_release_assets: true` (its default). -- **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's leaf also uploads a `release-asset-*` carrying the package, and PyPI contributes none. +- **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's and PyPI's default leaves also upload a `release-asset-*` carrying the package files. - **Image-registry push** (Docker): the leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes no `release-asset-*`. The arm64 emulation is reserved for the released image. - **Filesystem on a host the project owns** (a static site, a config tree): the leaf builds the tree and ships it to the host. It contributes no `release-asset-*`. The transport is the repo's own. The contract fixes the rest. The deploy is a **separate `workflow_dispatch`** from the release, so a redeploy of an unchanged commit mints no tag. A host rebuild, a rollback, or proving a branch on a non-production environment then costs nothing. Its credentials come from a **per-environment GitHub Environment** rather than the repository secret store. The deploy also ends by asserting **what the host serves** rather than the transport's exit status (D4.6). Retention at the destination is bounded by a declared count, with one side recorded as owning the prune. That side is the deploy where its credential can observe the destination, and the host where that credential is deliberately write-only (D5.6). -- **No file target via the release task** (Docker-only, PyPI-only, source-only): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). +- **No file target** (Docker-only, source-only, or PyPI with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). `WORKFLOW.md` section 3 keeps the architecture. The `workflow-ci-contract` Skill carries this section whole as a generated include, at `.agents/skills/workflow-ci-contract/references/architecture.md` in the hub. That path is not a repo-relative link, since it is hub-local and not carried into every fleet repo. @@ -167,7 +167,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output - **D4.1 Gated single-branch publish.** Output: PRs smoke-test and publish nothing. A **human merge never auto-publishes**. A `plan` job (`publish-plan-task.yml`) decides once. A job downstream of it either gates on the plan's outputs or inherits the skip through `needs:`. A gate on an output compares it against `'true'` rather than testing it bare, since a job output is always a string. A publish runs on a **code-affecting bot push to `main`**, gated to the codegen App / Dependabot `github.actor`. On that trigger, an Actions-only bump matches no release path and publishes nothing. A publish also runs on a **dispatch** of `main`/`develop`, or on a **main-only weekly schedule** (Docker). A source-only repo publishes on dispatch only. The plan reports every `schedule` as a publish, so a publisher with no `push` trigger whose schedule retests and never publishes gates its release itself. Each of its jobs calling `build-release-task.yml` carries `github.event_name == 'workflow_dispatch'` as an `&&` term of its job-level `if:` holding no `||` or negated group. Each run builds one branch. The D4.7 supersede dispatch has one accepted, bounded window that publishes without the allowlist check. - **D4.2 Tag the built commit.** Output: the release `target_commitish` is the built commit's SHA (NBGV's `GitCommitId`), never a branch name or a separately re-resolved ref. *Prevents: the tag landing on the default branch instead of the built tree.* -- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only, PyPI-only, and source-only repos. A NuGet target is not among them, since its leaf uploads a `release-asset-*` carrying the package, so a NuGet-only caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. +- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. - **D4.4 No-op republish.** Input: a re-run whose version is unchanged, on a schedule or push trigger. Output: no second release is cut, because the release-create step is skipped when `gh release view` finds a release for the tag. The paired asset-delete is skipped with it. A **dispatch** re-run refreshes the release instead and runs that delete with it. That is why a dispatch-only publisher records this item's skip leg as unreachable rather than failed. Package-registry pushes are no-ops. The NuGet/PyPI publish steps are **not** statically gated on existence. They run and the **server** dedupes (`dotnet nuget push --skip-duplicate` turns a 409 into success, and PyPI does the same under `skip-existing: true`). **Docker always re-pushes** the image (base-image refresh), independently of the release-create skip, within the same run. *Prevents: duplicate releases and wasted pushes.* - **D4.5 A build failure blocks every publish target, within the Docker limit below.** Input: a real publish where one enabled build fails. Output: nothing publishes. The limit applies where a Docker target builds a shared base or more than one image. Its task then pushes the base and each image leg as it builds. So a leg failing after the base or a sibling leg pushed leaves those images in the registry with no release. `github-release` needs every build and carries the same `!failure() && !cancelled()` guard the terminal registry pusher (Docker) does. Without that guard, the implicit `success()` would skip both on every run that disables a target, rather than only on a failed one. A failed build therefore skips the release (no tag, no release). Docker, which needs every other build, skips with it (no image push). By contrast, a **disabled** target, skipped rather than failed, still lets docker push. A package target's separate publish job needs its own gate for the same reason, since it sits outside the `github-release` and Docker `needs:` chains. That gate is that it `needs:` the release-task call, so a failed build skips it with the rest. The push itself is what no gate can cover, because it runs after the whole release task and therefore after `github-release`. It runs there for the trusted-publishing reason `WORKFLOW.md` section 3's "Output Seam by Destination" package-registry bullet gives. So a rejected token exchange, a registry outage, or a trusted-publishing policy naming the wrong workflow file leaves a published release and tag. That release and tag are for a version that never reached the registry. The recovery is a re-dispatch or a full re-run rather than a cleanup. **A full re-run is always available inside its window and is the only route once the branch tip has moved.** The `Re-run failed jobs` shortcut is not a third route here, D5.2's delete having already removed the artifact it would download. `GOVERNANCE.md` "Release Model", and the skill it routes to, carry the mechanics of each route, how to choose, and the window. *Prevents: a partial publish, e.g. a Docker image pushed while .NET publish failed and no release was cut.* - **D4.6 Deploy verification names the release.** Input: a deploy to a filesystem on a host the project owns that completes without error. Output: a check against the running host asserts **which release is answering**, not merely that it answers. The artifact stamps its own version into the configuration it ships, and the check compares that against the version just installed. The check **waits for convergence to a bounded timeout** rather than sampling once. That is because content goes live the instant a pointer moves, while server rules wait on an asynchronous reload. The same check asserts **which environment** answered. That is because several environments serve a byte-identical artifact, and a proxy rule aimed at the wrong one answers healthily under the right hostname. An unreachable host is reported distinctly from an HTTP status. *Prevents: a green deploy over a host still serving the previous release's configuration, and a URL contract checked against the wrong environment. It also prevents a dead config watcher read as a routing fault.* @@ -184,7 +184,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output ### D6 - Seam / Architecture Conformance -- **D6.1 Pattern handoff.** Output: the release job downloads by `pattern:`/`merge-multiple:`, not `artifact-ids:`. **File** targets upload `release-asset--`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `` with `build-release-asset`. A target contributing no file to the release (Docker, PyPI) uploads no `release-asset-*` of its own, per D4.3, whatever other transfer artifact it uploads. The `pattern:` download is canonical for a single-target repo too, which does not special-case itself to `artifact-ids:`. +- **D6.1 Pattern handoff.** Output: the release job downloads by `pattern:`/`merge-multiple:`, not `artifact-ids:`. **File** targets upload `release-asset--`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `` with `build-release-asset`. A target contributing no file to the release (Docker) uploads no `release-asset-*` of its own, per D4.3, whatever other transfer artifact it uploads. The `pattern:` download is canonical for a single-target repo too, which does not special-case itself to `artifact-ids:`. - **D6.2 Branch drives config.** Output: a called workflow's branch-derived config reads `inputs.branch`, never `github.ref_name`. - **D6.3 Branch-named artifacts.** Output: every artifact name carries the branch, so a branch's artifacts do not collide with another branch's. - **D6.4 Target add/drop is consistent.** Output: adding or dropping a target updates **all** of the following. The list is the `enable_` value the publisher passes to the release task, and the publisher's `on.push.paths` entries where it carries a `push` trigger. The list continues with the `changes` paths-filter entry + output and the `smoke-build` enable-forward. The list includes `expect_release_assets` where the change adds the first file target or drops the last (D4.3). For a package target, the list also includes the separate `publish-` job. A repo owning its release task also updates the target's build job there, `build-` or `dotnet-publish` for the .NET target. It also updates the target's `github-release` and `build-docker` `needs:` entries. Everything in the `github-release` job **except its `needs:` list** stays verbatim, and so does the version and publish-plan logic. "Verbatim" never reaches the surfaces this item requires editing, that `needs:` list, the release task's job list, and the paths-filter among them. *Prevents: a partial subset that startup-fails on a missing leaf or never smoke-builds a target.* @@ -300,7 +300,7 @@ What each type adds beyond that, and how its leaf behaves, is below. - **`dotnet-publish`.** The target runs a sequential `dotnet publish` runtime loop inside one composite-action job. Configuration is Release on the default branch and Debug otherwise. A non-smoke run builds the full runtime set, archives the combined output as a `.7z`, and uploads it as `release-asset--dotnet-publish`. The archive is named from the project file stem unless `dotnet_publish_asset_name` overrides it. A smoke run builds a **strict, non-empty subset** of that runtime set and skips the archive and upload steps, so it uploads nothing. S1 smoke-builds that subset after a .NET project change. S7 attaches the 7z from a non-smoke run. The non-default leg sets `prerelease=true`, and the default leg sets `prerelease=false`. GitHub marks the stable default release "Latest" automatically. - **`nuget`.** The leaf uploads both `release-asset--nuget` and `nuget-build-` on a non-smoke run and pushes nothing. A separate `publish-nuget` job in the repo's own publisher consumes the second and runs `dotnet nuget push *.nupkg --skip-duplicate`. It then deletes that artifact under the download step's own success (D5.2). Section 3's `Output Seam by Destination` says why the push sits there rather than in the leaf. Configuration is Release on the default branch, Debug otherwise. The default leaf is followed by the D1.7 package consume check in smoke and publish runs alike. A caller's own `build-nuget` hook is outside it. The release-asset `.7z` carries the packages alone, never the loose build output, since each package already holds every target framework's build under its own `lib//`. Where symbols are enabled (`snupkg`), the push auto-carries the paired `.snupkg` to NuGet.org's symbol server and the release-asset `.7z` also contains it, a triple surface. NuGet.org derives `isPrerelease` from the SemVer2 `-g` suffix (the workflow sets no such flag). Test: S15 consumes the package per framework. S7 non-default leg publishes a prerelease package + asset, default a stable. S9 re-run is a server-side `--skip-duplicate` no-op. 5C: query NuGet.org for both versions and the symbol package. -- **`pypi`.** The leaf builds and uploads `pypi-build-`. A **separate** `publish-pypi` job (with `environment: pypi`, `id-token: write`, `actions: write`) does the OIDC Trusted-Publishing upload with `skip-existing: true`. It then **consume-then-deletes** the build artifact under the download step's own success (D5.2). So on S9 the build artifact is deleted even though the `release-asset-*` delete is skipped. The version is the `X.Y.Z` core of `SemVer2` with `.dev0` appended on `develop` only, per D3.4. PyPI contributes no `release-asset-*`. The default leaf is followed by the D1.8 package consume check in smoke and publish runs alike. A caller's own `build-pypi` hook is outside it. A PyPI-only repo sets `expect_release_assets: false` at the caller. Test: S16 consumes the wheel and the sdist per Python line. S7 default leg publishes a release, non-default a `.dev0`. S9 is a `skip-existing` no-op. 5C inspects the `dist/*` filenames and the compute-version log. +- **`pypi`.** The leaf uploads `release-asset--pypi` and `pypi-build-` on a non-smoke run. The first carries the wheel and sdist unzipped, so the release attaches the files directly. A **separate** `publish-pypi` job (with `environment: pypi`, `id-token: write`, `actions: write`) does the OIDC Trusted-Publishing upload with `skip-existing: true`. It then **consume-then-deletes** the build artifact under the download step's own success (D5.2). So on S9 the build artifact is deleted even though the `release-asset-*` delete is skipped. The version is the `X.Y.Z` core of `SemVer2` with `.dev0` appended on `develop` only, per D3.4. The default leaf is followed by the D1.8 package consume check in smoke and publish runs alike. A caller's own `build-pypi` hook is outside it. A PyPI-only repo on the default leaf keeps `expect_release_assets` true, and one whose own `build-pypi` hook uploads no `release-asset-*` sets it false. Test: S16 consumes the wheel and the sdist per Python line. S7 default leg publishes a release, non-default a `.dev0`. S9 is a `skip-existing` no-op. 5C inspects the `dist/*` filenames and the compute-version log. - **`docker`.** The leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, with a per-branch registry buildcache. A single-image repo caches to `:buildcache-`. A multi-image repo varies the cache **repository** rather than the tag, `:buildcache-` for each image, since the tag alone cannot distinguish two images. `cache-to` writes only the built branch and only on push, and `cache-from` reads both branches. It contributes no `release-asset-*`, so a Docker-only repo's caller passes `expect_release_assets: false`. The readme job (`peter-evans/dockerhub-description`, `DOCKER_HUB_ACCESS_TOKEN`) runs **only** when the default branch publishes, whether called directly or reached through the hub-hosted `publish-docker-readme-task.yml`. Where the Docker Hub overview differs from the project README, the repo publishes a `Docker/README.md` through that task, the Hub description being size-limited. The docker-readme task validates its two mutually-exclusive input sources, `repositories` against `manifest`+`manifest-jq`. It defaults to the calling repository where neither is supplied. A multi-image repo derives its publish matrix from the manifest. Docker **always re-pushes** the image, independently of a skipped release-create (S9). The tests that follow assume the default tag matrix, which a caller-supplied `matrix` or `docker-prepare` hook replaces. Test: S7 default leg pushes `latest` + the version tag and updates the readme. Non-default pushes `develop` + the version tag (amd64 only). S9 still re-pushes. 5C Docker probe needs `DOCKER_HUB_*` secrets and same-repo (not fork) runs. - **`library` (a worked example, not a fleet type).** No such leaf ships, so this row walks D6.4's add-a-target procedure rather than an existing shape. The target is a single new leaf that validates, zips, and uploads `release-asset--library` (`retention-days: 1` per D5.4, upload gated on smoke being false per D1.3). Adding it means a new `enable_library` input, and a `build-library` job and its `github-release` and `build-docker` `needs:` entries, in the release task. In the PR workflow it means a `library` paths-filter entry, `changes` output, and `smoke-build` enable-forward. Without that last one, D1.1 never smoke-builds the library. In the publisher, it means the `enable_library` value the publisher passes, and the library's paths in its `on.push.paths` where it carries a `push` trigger. **Only a repo that owns its release task can make the release-task half of that edit.** The hub-hosted release task declares a closed input set, and a call passing an input it does not declare fails. So a repo calling it sets `enable_release_asset` instead and carries the leaf as its `build-release-asset` hook. The hook writes the zip, and the task uploads it under `release-asset--build-release-asset`, skipping the upload on a smoke run. Keep `expect_release_assets: true` (it has a file target, unlike Docker). The caller's own validation job is replaced by a type-appropriate validator only where the reusable one cannot express this repo's validation. The aggregator is then re-pointed to the replacement (D1.2). `smoke-build` keeps `needs: [changes]`, as D1.2 has it. `version.json` and the NBGV `get-version` **job** are retained (they own the tag). Test: S1 smoke runs validate+zip and uploads nothing. S7 attaches the zip, prerelease on the non-default leg. S9 on a push re-run skips release-create and the asset-delete (the existing zip is untouched, no registry push). A `workflow_dispatch` re-run, by contrast, is D4.4's refresh case rather than S9's, re-uploading then re-deleting the asset. - **`upstream-wrapper`.** The repo tracks an upstream project's releases rather than versioning its own code. A scheduled resolver writes a `name -> version` state file and opens a per-branch bump pull request. The merge-bot auto-merges it, or leaves it for the maintainer where the tracker sets `auto-merge: false` (D8.3). The build leaf MUST read that state file for its build or image version instead of `SemVer2`, while NBGV still tags the release (D3.5). That is because the tracker ships without this consumer wiring. Test: S11 traces the bump from resolver to the publish that ships it, which for a merge-bot-merged `main` pin is D8.3's gated publish. Nothing in this row depends on which build-target types the wrapper also declares. diff --git a/tests/test_release_guards.py b/tests/test_release_guards.py index 285798d66..7857e5d53 100755 --- a/tests/test_release_guards.py +++ b/tests/test_release_guards.py @@ -628,6 +628,33 @@ def names_a_ref(line: str) -> bool: with self.subTest(form=form): self.assertFalse(names_a_ref(form)) + def test_default_leaves_upload_a_smoke_gated_release_asset(self) -> None: + # A leaf contributing the package to the GitHub release uploads it under the pattern the release job collects. + # A typo in the name leaves the release without the files, and a missing gate lets a smoke run upload. + for leaf, target in (("nuget", "nuget"), ("pypi", "pypi")): + with self.subTest(leaf=leaf): + action = (REPO / f".github/actions/{leaf}-build-default/action.yml").read_text( + encoding="utf-8" + ) + match = re.search( + r"(?ms)^ - name: Upload release asset step\n(?P.*?)(?=^ - name: |\Z)", + action, + ) + self.assertIsNotNone(match) + assert match is not None + body = match.group("body") + self.assertIn("if: ${{ inputs.smoke != 'true' }}", body) + self.assertRegex( + body, + rf"(?m)^[ \t]*name: release-asset-\$\{{\{{ inputs\.branch \}}\}}-{target}[ \t]*$", + ) + self.assertRegex(body, r"(?m)^[ \t]*retention-days: 1[ \t]*$") + + # The wheel and sdist are attached as they are, so the upload takes the files rather than an archive. + pypi = (REPO / ".github/actions/pypi-build-default/action.yml").read_text(encoding="utf-8") + self.assertIn("path: ${{ inputs.project-dir }}/dist/*", pypi) + self.assertIn("if-no-files-found: error", pypi) + def test_nuget_artifact_name_matches_contracts_and_consumers(self) -> None: canonical_name = "nuget-build-" legacy_name = "nuget-push" + "-default" From 0a616d3bc737ba164155281c5cf15aedca6a5890 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 3 Dec 2026 06:48:01 -0800 Subject: [PATCH 2/7] Answer the Local Review of the PyPI Release Asset Upload Draw the PyPI release-asset edge in the seam diagram, stop telling a PyPI caller to set expect_release_assets false, and read the new step's own keys in the test. Part of #4609 Co-Authored-By: Claude Sonnet 5.5 --- .../workflow-ci-contract/references/architecture.md | 3 ++- .../fleet-skills/.source-digests/workflow-ci-contract | 2 +- .../workflow-ci-contract/references/architecture.md | 3 ++- .github/actions/pypi-build-default/action.yml | 3 ++- .../workflow-ci-contract/references/architecture.md | 3 ++- WORKFLOW.md | 3 ++- docs/reusable-workflows.md | 2 +- tests/test_release_guards.py | 9 ++++++--- 8 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.agents/skills/workflow-ci-contract/references/architecture.md b/.agents/skills/workflow-ci-contract/references/architecture.md index c1c3e0452..5abdc8f33 100644 --- a/.agents/skills/workflow-ci-contract/references/architecture.md +++ b/.agents/skills/workflow-ci-contract/references/architecture.md @@ -44,9 +44,10 @@ A target contributes a file to the GitHub release by uploading a workflow artifa flowchart LR dotnet[dotnet-publish] -->|release-asset-BRANCH-dotnet-publish| store[(run artifacts)] nuget[build-nuget] -->|release-asset-BRANCH-nuget| store + pypi[build-pypi] -->|release-asset-BRANCH-pypi| store store -->|pattern + merge-multiple| rel["github-release job (D6)"] nuget -->|nuget-build-BRANCH| pub["publish-TARGET job in the repo's own publisher"] - pypi[build-pypi] -->|pypi-build-BRANCH| pub + pypi -->|pypi-build-BRANCH| pub pub -->|push| registries[(registries)] docker[build-docker] -->|push| registries ``` diff --git a/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract b/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract index d98d667ee..16f93dc50 100644 --- a/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract +++ b/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract @@ -1 +1 @@ -2469cf083b301a35 +6617186e95d921b8 diff --git a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md index c1c3e0452..5abdc8f33 100644 --- a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md +++ b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md @@ -44,9 +44,10 @@ A target contributes a file to the GitHub release by uploading a workflow artifa flowchart LR dotnet[dotnet-publish] -->|release-asset-BRANCH-dotnet-publish| store[(run artifacts)] nuget[build-nuget] -->|release-asset-BRANCH-nuget| store + pypi[build-pypi] -->|release-asset-BRANCH-pypi| store store -->|pattern + merge-multiple| rel["github-release job (D6)"] nuget -->|nuget-build-BRANCH| pub["publish-TARGET job in the repo's own publisher"] - pypi[build-pypi] -->|pypi-build-BRANCH| pub + pypi -->|pypi-build-BRANCH| pub pub -->|push| registries[(registries)] docker[build-docker] -->|push| registries ``` diff --git a/.github/actions/pypi-build-default/action.yml b/.github/actions/pypi-build-default/action.yml index 3a5e02fa4..3a39b385d 100644 --- a/.github/actions/pypi-build-default/action.yml +++ b/.github/actions/pypi-build-default/action.yml @@ -144,5 +144,6 @@ runs: name: release-asset-${{ inputs.branch }}-pypi path: ${{ inputs.project-dir }}/dist/* if-no-files-found: error - # Consumed within the run by the github-release job, so minimize artifact storage. + # Consumed within the run by the github-release job, which a caller passing expect_release_assets false skips. + # The short retention bounds what such a caller leaves behind. retention-days: 1 diff --git a/.github/skills/workflow-ci-contract/references/architecture.md b/.github/skills/workflow-ci-contract/references/architecture.md index c1c3e0452..5abdc8f33 100644 --- a/.github/skills/workflow-ci-contract/references/architecture.md +++ b/.github/skills/workflow-ci-contract/references/architecture.md @@ -44,9 +44,10 @@ A target contributes a file to the GitHub release by uploading a workflow artifa flowchart LR dotnet[dotnet-publish] -->|release-asset-BRANCH-dotnet-publish| store[(run artifacts)] nuget[build-nuget] -->|release-asset-BRANCH-nuget| store + pypi[build-pypi] -->|release-asset-BRANCH-pypi| store store -->|pattern + merge-multiple| rel["github-release job (D6)"] nuget -->|nuget-build-BRANCH| pub["publish-TARGET job in the repo's own publisher"] - pypi[build-pypi] -->|pypi-build-BRANCH| pub + pypi -->|pypi-build-BRANCH| pub pub -->|push| registries[(registries)] docker[build-docker] -->|push| registries ``` diff --git a/WORKFLOW.md b/WORKFLOW.md index f03496ff5..0036f6198 100644 --- a/WORKFLOW.md +++ b/WORKFLOW.md @@ -67,9 +67,10 @@ A target contributes a file to the GitHub release by uploading a workflow artifa flowchart LR dotnet[dotnet-publish] -->|release-asset-BRANCH-dotnet-publish| store[(run artifacts)] nuget[build-nuget] -->|release-asset-BRANCH-nuget| store + pypi[build-pypi] -->|release-asset-BRANCH-pypi| store store -->|pattern + merge-multiple| rel["github-release job (D6)"] nuget -->|nuget-build-BRANCH| pub["publish-TARGET job in the repo's own publisher"] - pypi[build-pypi] -->|pypi-build-BRANCH| pub + pypi -->|pypi-build-BRANCH| pub pub -->|push| registries[(registries)] docker[build-docker] -->|push| registries ``` diff --git a/docs/reusable-workflows.md b/docs/reusable-workflows.md index 57a98124e..7c5ac63bc 100644 --- a/docs/reusable-workflows.md +++ b/docs/reusable-workflows.md @@ -704,7 +704,7 @@ jobs: done ``` -A Docker repo's stub removes the `push:` block (its paths filter with it). It adds `schedule: - cron: '0 2 * * MON'` to the trigger block. It sets `enable_docker: true`, `dockerhub: true`, `docker_image: ptr727/widget`, `enable_nuget: false` (dropping `nuget_project` with it) and `expect_release_assets: false`. It maps `DOCKER_HUB_USERNAME`/`DOCKER_HUB_ACCESS_TOKEN` under the `publish` job's `secrets:`. It drops the `publish-nuget` job, since Docker Hub has no OIDC equivalent and the hub task pushes the image itself. A PyPI repo sets `enable_pypi: true` with `pypi_project_dir` and `pypi_version_file`. It also sets `enable_nuget: false` (dropping `nuget_project`) and `expect_release_assets: false`, since PyPI contributes no release asset. It swaps `publish-nuget` for the same shape one registry over, verbatim as today's: +A Docker repo's stub removes the `push:` block (its paths filter with it). It adds `schedule: - cron: '0 2 * * MON'` to the trigger block. It sets `enable_docker: true`, `dockerhub: true`, `docker_image: ptr727/widget`, `enable_nuget: false` (dropping `nuget_project` with it) and `expect_release_assets: false`. It maps `DOCKER_HUB_USERNAME`/`DOCKER_HUB_ACCESS_TOKEN` under the `publish` job's `secrets:`. It drops the `publish-nuget` job, since Docker Hub has no OIDC equivalent and the hub task pushes the image itself. A PyPI repo sets `enable_pypi: true` with `pypi_project_dir` and `pypi_version_file`. It also sets `enable_nuget: false` (dropping `nuget_project`) and keeps `expect_release_assets` at its default, since the default PyPI leaf uploads a release asset. It swaps `publish-nuget` for the same shape one registry over, verbatim as today's: ```yaml publish-pypi: diff --git a/tests/test_release_guards.py b/tests/test_release_guards.py index 7857e5d53..ddc013960 100755 --- a/tests/test_release_guards.py +++ b/tests/test_release_guards.py @@ -651,9 +651,12 @@ def test_default_leaves_upload_a_smoke_gated_release_asset(self) -> None: self.assertRegex(body, r"(?m)^[ \t]*retention-days: 1[ \t]*$") # The wheel and sdist are attached as they are, so the upload takes the files rather than an archive. - pypi = (REPO / ".github/actions/pypi-build-default/action.yml").read_text(encoding="utf-8") - self.assertIn("path: ${{ inputs.project-dir }}/dist/*", pypi) - self.assertIn("if-no-files-found: error", pypi) + pypi = yaml_step( + (REPO / ".github/actions/pypi-build-default/action.yml").read_text(encoding="utf-8"), + "Upload release asset step", + ) + self.assertEqual("${{ inputs.project-dir }}/dist/*", yaml_value(pypi, "with", "path")) + self.assertEqual("error", yaml_value(pypi, "with", "if-no-files-found")) def test_nuget_artifact_name_matches_contracts_and_consumers(self) -> None: canonical_name = "nuget-build-" From 6f4ddede2450853c3dcb1e2671af2fa6db50a79c Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 3 Dec 2026 06:51:56 -0800 Subject: [PATCH 3/7] Close the Stale PyPI Release Asset Statements and Harden the Smoke Gate Test Part of #4609 Co-Authored-By: Claude Sonnet 5.5 --- .../references/release-publish-mechanics.md | 12 ++++----- .../branching-and-release-model | 2 +- .../references/release-publish-mechanics.md | 12 ++++----- .github/actions/pypi-build-default/action.yml | 2 +- .../references/release-publish-mechanics.md | 12 ++++----- .github/workflows/build-release-task.yml | 2 +- WORKFLOW.md | 2 +- docs/reusable-workflows.md | 2 +- tests/test_release_guards.py | 27 ++++++++----------- 9 files changed, 34 insertions(+), 39 deletions(-) diff --git a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md index c47e74394..2b88251a8 100644 --- a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -45,7 +45,7 @@ project-path inputs among them. Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish - hook or a build-nuget hook per output, each uploading `release-asset--`. This is where the + hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. This is where the .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook @@ -62,11 +62,11 @@ Pick by where each artifact *goes*, not by language: the caller's own `publish-release.yml`. That job authenticates through `NuGet/login` and therefore carries `id-token: write` (plus `actions: write` to delete the artifact it consumed). The hook *also* uploads a `release-asset-*` (.7z) for the GitHub release. - PyPI is the same shape: the hub default leaf uploads the `pypi-build-` artifact and a - `release-asset--pypi` carrying the wheel and sdist. - The separate `publish-pypi` job in the caller's own - `publish-release.yml` does the OIDC Trusted-Publishing upload, behind an `environment: pypi` - gate and with `skip-existing: true`. The `id-token: write` permission is granted only at that + PyPI is the same shape. + The hub default leaf uploads the `pypi-build-` artifact and a `release-asset--pypi` carrying the wheel and sdist. + The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload. + It runs behind an `environment: pypi` gate and with `skip-existing: true`. + The `id-token: write` permission is granted only at that one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other diff --git a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model index 4e18dd2aa..ff8e42584 100644 --- a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model +++ b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model @@ -1 +1 @@ -a510e6b2971dc678 +3cf7617052234183 diff --git a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md index c47e74394..2b88251a8 100644 --- a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -45,7 +45,7 @@ project-path inputs among them. Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish - hook or a build-nuget hook per output, each uploading `release-asset--`. This is where the + hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. This is where the .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook @@ -62,11 +62,11 @@ Pick by where each artifact *goes*, not by language: the caller's own `publish-release.yml`. That job authenticates through `NuGet/login` and therefore carries `id-token: write` (plus `actions: write` to delete the artifact it consumed). The hook *also* uploads a `release-asset-*` (.7z) for the GitHub release. - PyPI is the same shape: the hub default leaf uploads the `pypi-build-` artifact and a - `release-asset--pypi` carrying the wheel and sdist. - The separate `publish-pypi` job in the caller's own - `publish-release.yml` does the OIDC Trusted-Publishing upload, behind an `environment: pypi` - gate and with `skip-existing: true`. The `id-token: write` permission is granted only at that + PyPI is the same shape. + The hub default leaf uploads the `pypi-build-` artifact and a `release-asset--pypi` carrying the wheel and sdist. + The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload. + It runs behind an `environment: pypi` gate and with `skip-existing: true`. + The `id-token: write` permission is granted only at that one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other diff --git a/.github/actions/pypi-build-default/action.yml b/.github/actions/pypi-build-default/action.yml index 3a39b385d..f1da12f78 100644 --- a/.github/actions/pypi-build-default/action.yml +++ b/.github/actions/pypi-build-default/action.yml @@ -1,5 +1,5 @@ name: Build PyPI package default -description: Build a wheel and source distribution for the publish-pypi job. +description: Build a wheel and source distribution for the publish-pypi job and the GitHub release. inputs: branch: diff --git a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md index c47e74394..2b88251a8 100644 --- a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -45,7 +45,7 @@ project-path inputs among them. Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish - hook or a build-nuget hook per output, each uploading `release-asset--`. This is where the + hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. This is where the .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook @@ -62,11 +62,11 @@ Pick by where each artifact *goes*, not by language: the caller's own `publish-release.yml`. That job authenticates through `NuGet/login` and therefore carries `id-token: write` (plus `actions: write` to delete the artifact it consumed). The hook *also* uploads a `release-asset-*` (.7z) for the GitHub release. - PyPI is the same shape: the hub default leaf uploads the `pypi-build-` artifact and a - `release-asset--pypi` carrying the wheel and sdist. - The separate `publish-pypi` job in the caller's own - `publish-release.yml` does the OIDC Trusted-Publishing upload, behind an `environment: pypi` - gate and with `skip-existing: true`. The `id-token: write` permission is granted only at that + PyPI is the same shape. + The hub default leaf uploads the `pypi-build-` artifact and a `release-asset--pypi` carrying the wheel and sdist. + The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload. + It runs behind an `environment: pypi` gate and with `skip-existing: true`. + The `id-token: write` permission is granted only at that one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other diff --git a/.github/workflows/build-release-task.yml b/.github/workflows/build-release-task.yml index e83a99d73..58b2dcff8 100644 --- a/.github/workflows/build-release-task.yml +++ b/.github/workflows/build-release-task.yml @@ -302,7 +302,7 @@ jobs: feed-dir: ${{ runner.temp }}/publish # PyPI publishing happens in the caller stub's own publish-pypi job, since id-token: write is granted only at that one entry point. - # This job just builds and uploads the artifact for that job to download. + # This job builds and uploads the artifact for that job to download, and the release asset for the github-release job. build-pypi: name: Build PyPI library job if: ${{ inputs.enable_pypi }} diff --git a/WORKFLOW.md b/WORKFLOW.md index 0036f6198..c9e75b80a 100644 --- a/WORKFLOW.md +++ b/WORKFLOW.md @@ -301,7 +301,7 @@ What each type adds beyond that, and how its leaf behaves, is below. - **`dotnet-publish`.** The target runs a sequential `dotnet publish` runtime loop inside one composite-action job. Configuration is Release on the default branch and Debug otherwise. A non-smoke run builds the full runtime set, archives the combined output as a `.7z`, and uploads it as `release-asset--dotnet-publish`. The archive is named from the project file stem unless `dotnet_publish_asset_name` overrides it. A smoke run builds a **strict, non-empty subset** of that runtime set and skips the archive and upload steps, so it uploads nothing. S1 smoke-builds that subset after a .NET project change. S7 attaches the 7z from a non-smoke run. The non-default leg sets `prerelease=true`, and the default leg sets `prerelease=false`. GitHub marks the stable default release "Latest" automatically. - **`nuget`.** The leaf uploads both `release-asset--nuget` and `nuget-build-` on a non-smoke run and pushes nothing. A separate `publish-nuget` job in the repo's own publisher consumes the second and runs `dotnet nuget push *.nupkg --skip-duplicate`. It then deletes that artifact under the download step's own success (D5.2). Section 3's `Output Seam by Destination` says why the push sits there rather than in the leaf. Configuration is Release on the default branch, Debug otherwise. The default leaf is followed by the D1.7 package consume check in smoke and publish runs alike. A caller's own `build-nuget` hook is outside it. The release-asset `.7z` carries the packages alone, never the loose build output, since each package already holds every target framework's build under its own `lib//`. Where symbols are enabled (`snupkg`), the push auto-carries the paired `.snupkg` to NuGet.org's symbol server and the release-asset `.7z` also contains it, a triple surface. NuGet.org derives `isPrerelease` from the SemVer2 `-g` suffix (the workflow sets no such flag). Test: S15 consumes the package per framework. S7 non-default leg publishes a prerelease package + asset, default a stable. S9 re-run is a server-side `--skip-duplicate` no-op. 5C: query NuGet.org for both versions and the symbol package. -- **`pypi`.** The leaf uploads `release-asset--pypi` and `pypi-build-` on a non-smoke run. The first carries the wheel and sdist unzipped, so the release attaches the files directly. A **separate** `publish-pypi` job (with `environment: pypi`, `id-token: write`, `actions: write`) does the OIDC Trusted-Publishing upload with `skip-existing: true`. It then **consume-then-deletes** the build artifact under the download step's own success (D5.2). So on S9 the build artifact is deleted even though the `release-asset-*` delete is skipped. The version is the `X.Y.Z` core of `SemVer2` with `.dev0` appended on `develop` only, per D3.4. The default leaf is followed by the D1.8 package consume check in smoke and publish runs alike. A caller's own `build-pypi` hook is outside it. A PyPI-only repo on the default leaf keeps `expect_release_assets` true, and one whose own `build-pypi` hook uploads no `release-asset-*` sets it false. Test: S16 consumes the wheel and the sdist per Python line. S7 default leg publishes a release, non-default a `.dev0`. S9 is a `skip-existing` no-op. 5C inspects the `dist/*` filenames and the compute-version log. +- **`pypi`.** The leaf uploads `release-asset--pypi` and `pypi-build-` on a non-smoke run. The first carries the wheel and sdist unzipped, so the release attaches the files directly. A **separate** `publish-pypi` job (with `environment: pypi`, `id-token: write`, `actions: write`) does the OIDC Trusted-Publishing upload with `skip-existing: true`. It then **consume-then-deletes** the build artifact under the download step's own success (D5.2). So on S9 the build artifact is deleted even though the `release-asset-*` delete is skipped. The version is the `X.Y.Z` core of `SemVer2` with `.dev0` appended on `develop` only, per D3.4. The default leaf is followed by the D1.8 package consume check in smoke and publish runs alike. A caller's own `build-pypi` hook is outside it. A PyPI-only repo on the default leaf keeps `expect_release_assets` true, and one whose own `build-pypi` hook uploads no `release-asset-*` sets it false. Test: S16 consumes the wheel and the sdist per Python line. S7 default leg publishes a release, non-default a `.dev0`, and the release carries the wheel and the sdist. S9 is a `skip-existing` no-op. 5C inspects the `dist/*` filenames and the compute-version log. - **`docker`.** The leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, with a per-branch registry buildcache. A single-image repo caches to `:buildcache-`. A multi-image repo varies the cache **repository** rather than the tag, `:buildcache-` for each image, since the tag alone cannot distinguish two images. `cache-to` writes only the built branch and only on push, and `cache-from` reads both branches. It contributes no `release-asset-*`, so a Docker-only repo's caller passes `expect_release_assets: false`. The readme job (`peter-evans/dockerhub-description`, `DOCKER_HUB_ACCESS_TOKEN`) runs **only** when the default branch publishes, whether called directly or reached through the hub-hosted `publish-docker-readme-task.yml`. Where the Docker Hub overview differs from the project README, the repo publishes a `Docker/README.md` through that task, the Hub description being size-limited. The docker-readme task validates its two mutually-exclusive input sources, `repositories` against `manifest`+`manifest-jq`. It defaults to the calling repository where neither is supplied. A multi-image repo derives its publish matrix from the manifest. Docker **always re-pushes** the image, independently of a skipped release-create (S9). The tests that follow assume the default tag matrix, which a caller-supplied `matrix` or `docker-prepare` hook replaces. Test: S7 default leg pushes `latest` + the version tag and updates the readme. Non-default pushes `develop` + the version tag (amd64 only). S9 still re-pushes. 5C Docker probe needs `DOCKER_HUB_*` secrets and same-repo (not fork) runs. - **`library` (a worked example, not a fleet type).** No such leaf ships, so this row walks D6.4's add-a-target procedure rather than an existing shape. The target is a single new leaf that validates, zips, and uploads `release-asset--library` (`retention-days: 1` per D5.4, upload gated on smoke being false per D1.3). Adding it means a new `enable_library` input, and a `build-library` job and its `github-release` and `build-docker` `needs:` entries, in the release task. In the PR workflow it means a `library` paths-filter entry, `changes` output, and `smoke-build` enable-forward. Without that last one, D1.1 never smoke-builds the library. In the publisher, it means the `enable_library` value the publisher passes, and the library's paths in its `on.push.paths` where it carries a `push` trigger. **Only a repo that owns its release task can make the release-task half of that edit.** The hub-hosted release task declares a closed input set, and a call passing an input it does not declare fails. So a repo calling it sets `enable_release_asset` instead and carries the leaf as its `build-release-asset` hook. The hook writes the zip, and the task uploads it under `release-asset--build-release-asset`, skipping the upload on a smoke run. Keep `expect_release_assets: true` (it has a file target, unlike Docker). The caller's own validation job is replaced by a type-appropriate validator only where the reusable one cannot express this repo's validation. The aggregator is then re-pointed to the replacement (D1.2). `smoke-build` keeps `needs: [changes]`, as D1.2 has it. `version.json` and the NBGV `get-version` **job** are retained (they own the tag). Test: S1 smoke runs validate+zip and uploads nothing. S7 attaches the zip, prerelease on the non-default leg. S9 on a push re-run skips release-create and the asset-delete (the existing zip is untouched, no registry push). A `workflow_dispatch` re-run, by contrast, is D4.4's refresh case rather than S9's, re-uploading then re-deleting the asset. - **`upstream-wrapper`.** The repo tracks an upstream project's releases rather than versioning its own code. A scheduled resolver writes a `name -> version` state file and opens a per-branch bump pull request. The merge-bot auto-merges it, or leaves it for the maintainer where the tracker sets `auto-merge: false` (D8.3). The build leaf MUST read that state file for its build or image version instead of `SemVer2`, while NBGV still tags the release (D3.5). That is because the tracker ships without this consumer wiring. Test: S11 traces the bump from resolver to the publish that ships it, which for a merge-bot-merged `main` pin is D8.3's gated publish. Nothing in this row depends on which build-target types the wrapper also declares. diff --git a/docs/reusable-workflows.md b/docs/reusable-workflows.md index 7c5ac63bc..4ba98b522 100644 --- a/docs/reusable-workflows.md +++ b/docs/reusable-workflows.md @@ -56,7 +56,7 @@ A workflow whose job graph is identical across repos of a type is reached, not c ### The Hook Contract -A hook receives the fixed inputs [WORKFLOW.md "Reusable-Task Parameter Contract"][workflow-reusable-task-parameter-contract] gives a leaf today. Those are `ref`, `branch`, `smoke` where relevant, and the NBGV version outputs where a build needs them. It reports back through step outputs and, for a release target, through the existing artifact seam, `release-asset--`, which the hub's `github-release` job collects by pattern. Each task finds a hook by its `action.yml` alone, so a hook named `action.yaml` is never run. The `install-test-deps` hook is an exception, taking `leg` and `directories` inputs and reporting nothing back. It may also run a check that needs that leg's environment. A failure there fails the leg's `unit-test` job before its Python tests run. The `pre-test` hook is another, taking no inputs and reporting nothing back. Each `unit-test` leg runs it before the .NET SDK setup, where a .NET test project exists and the caller carries the hook. So a system tool a .NET test shells out to is installed before those tests run. The `build-release-asset` hook is another, writing its files into the `output-directory` it receives, on a smoke run too, and leaving the upload to the task. The task accepts only regular files at that directory's top level and refuses a subdirectory, a symlink, or a dot-prefixed name. A package hook also uploads the artifact its publish job consumes: a NuGet hook uploads `nuget-build-` as well as its `release-asset-*`. A PyPI hook uploads `pypi-build-` and no release asset at all. A NuGet or PyPI hook has to carry that exact package-artifact name or its publish job finds nothing. The `package-consume` hook is another, optional and taking `frameworks`, `package-id`, `version`, and `feed-dir` inputs while reporting nothing back. `build-nuget` runs it once after the hub default's own package consume check, in smoke and publish runs alike. So the hook loops over the JSON `frameworks` array itself. A caller carrying its own `build-nuget` hook gets neither check, since that hook's output location is unknown to the hub. The `validate` and `resolve-upstream` hooks can also take one string from their caller. `validate-task.yml` and `check-upstream-version-task.yml` each declare an optional `hook-input` input. Each passes a non-empty value on to its hook's own `hook-input` input. The task passes it from a step of its own, run only when the caller sets it. So a caller passing none runs a hook declaring no such input exactly as before. A caller that sets it needs a hook declaring `hook-input` as an optional input. The caller defines what the value means. It can name which of two callers runs the hook, or carry a change-gate result an expensive check skips on. The hub's no-op `validate-default` never receives it. A hook may use marketplace actions, which is the reason a hook is a composite action rather than a script. A toolchain setup, a Docker build, or a coverage upload is a `uses:` step, and a shell script cannot carry one. Action pins inside a hook follow the SHA-pinning rule like any other workflow content, and Dependabot bumps them in the repo that carries the hook. A hook runs with no persisted git credential, since every checkout ahead of a hook sets `persist-credentials: false`. A hook that runs git against the remote therefore passes its own credential to that call. +A hook receives the fixed inputs [WORKFLOW.md "Reusable-Task Parameter Contract"][workflow-reusable-task-parameter-contract] gives a leaf today. Those are `ref`, `branch`, `smoke` where relevant, and the NBGV version outputs where a build needs them. It reports back through step outputs and, for a release target, through the existing artifact seam, `release-asset--`, which the hub's `github-release` job collects by pattern. Each task finds a hook by its `action.yml` alone, so a hook named `action.yaml` is never run. The `install-test-deps` hook is an exception, taking `leg` and `directories` inputs and reporting nothing back. It may also run a check that needs that leg's environment. A failure there fails the leg's `unit-test` job before its Python tests run. The `pre-test` hook is another, taking no inputs and reporting nothing back. Each `unit-test` leg runs it before the .NET SDK setup, where a .NET test project exists and the caller carries the hook. So a system tool a .NET test shells out to is installed before those tests run. The `build-release-asset` hook is another, writing its files into the `output-directory` it receives, on a smoke run too, and leaving the upload to the task. The task accepts only regular files at that directory's top level and refuses a subdirectory, a symlink, or a dot-prefixed name. A package hook also uploads the artifact its publish job consumes: a NuGet hook uploads `nuget-build-` as well as its `release-asset-*`. A PyPI hook uploads `pypi-build-`, and a `release-asset--pypi` too where the caller keeps `expect_release_assets` true. A NuGet or PyPI hook has to carry that exact package-artifact name or its publish job finds nothing. The `package-consume` hook is another, optional and taking `frameworks`, `package-id`, `version`, and `feed-dir` inputs while reporting nothing back. `build-nuget` runs it once after the hub default's own package consume check, in smoke and publish runs alike. So the hook loops over the JSON `frameworks` array itself. A caller carrying its own `build-nuget` hook gets neither check, since that hook's output location is unknown to the hub. The `validate` and `resolve-upstream` hooks can also take one string from their caller. `validate-task.yml` and `check-upstream-version-task.yml` each declare an optional `hook-input` input. Each passes a non-empty value on to its hook's own `hook-input` input. The task passes it from a step of its own, run only when the caller sets it. So a caller passing none runs a hook declaring no such input exactly as before. A caller that sets it needs a hook declaring `hook-input` as an optional input. The caller defines what the value means. It can name which of two callers runs the hook, or carry a change-gate result an expensive check skips on. The hub's no-op `validate-default` never receives it. A hook may use marketplace actions, which is the reason a hook is a composite action rather than a script. A toolchain setup, a Docker build, or a coverage upload is a `uses:` step, and a shell script cannot carry one. Action pins inside a hook follow the SHA-pinning rule like any other workflow content, and Dependabot bumps them in the repo that carries the hook. A hook runs with no persisted git credential, since every checkout ahead of a hook sets `persist-credentials: false`. A hook that runs git against the remote therefore passes its own credential to that call. ### Pinning diff --git a/tests/test_release_guards.py b/tests/test_release_guards.py index ddc013960..f163fdce7 100755 --- a/tests/test_release_guards.py +++ b/tests/test_release_guards.py @@ -629,26 +629,21 @@ def names_a_ref(line: str) -> bool: self.assertFalse(names_a_ref(form)) def test_default_leaves_upload_a_smoke_gated_release_asset(self) -> None: - # A leaf contributing the package to the GitHub release uploads it under the pattern the release job collects. # A typo in the name leaves the release without the files, and a missing gate lets a smoke run upload. - for leaf, target in (("nuget", "nuget"), ("pypi", "pypi")): + for leaf in ("nuget", "pypi"): with self.subTest(leaf=leaf): - action = (REPO / f".github/actions/{leaf}-build-default/action.yml").read_text( - encoding="utf-8" + step = yaml_step( + (REPO / f".github/actions/{leaf}-build-default/action.yml").read_text( + encoding="utf-8" + ), + "Upload release asset step", ) - match = re.search( - r"(?ms)^ - name: Upload release asset step\n(?P.*?)(?=^ - name: |\Z)", - action, - ) - self.assertIsNotNone(match) - assert match is not None - body = match.group("body") - self.assertIn("if: ${{ inputs.smoke != 'true' }}", body) - self.assertRegex( - body, - rf"(?m)^[ \t]*name: release-asset-\$\{{\{{ inputs\.branch \}}\}}-{target}[ \t]*$", + self.assertEqual("${{ inputs.smoke != 'true' }}", yaml_value(step, "if")) + self.assertEqual( + f"release-asset-${{{{ inputs.branch }}}}-{leaf}", + yaml_value(step, "with", "name"), ) - self.assertRegex(body, r"(?m)^[ \t]*retention-days: 1[ \t]*$") + self.assertEqual("1", yaml_value(step, "with", "retention-days")) # The wheel and sdist are attached as they are, so the upload takes the files rather than an archive. pypi = yaml_step( From 120576667eaf8344c1436928094790b2508db6f7 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 3 Dec 2026 06:58:36 -0800 Subject: [PATCH 4/7] Scope the No-Asset Guidance to PyPI-Only Callers and Hold the Release Download in a Test Part of #4609 Co-Authored-By: Claude Sonnet 5.5 --- .../references/release-publish-mechanics.md | 7 ++++--- .../workflow-ci-contract/references/architecture.md | 2 +- .../workflow-ci-contract/references/d-guarantees.md | 2 +- .../.source-digests/branching-and-release-model | 2 +- .../fleet-skills/.source-digests/workflow-ci-contract | 2 +- .../references/release-publish-mechanics.md | 7 ++++--- .../workflow-ci-contract/references/architecture.md | 2 +- .../workflow-ci-contract/references/d-guarantees.md | 2 +- .github/actions/pypi-build-default/action.yml | 4 ++-- .../references/release-publish-mechanics.md | 7 ++++--- .../workflow-ci-contract/references/architecture.md | 2 +- .../workflow-ci-contract/references/d-guarantees.md | 2 +- .github/workflows/build-release-task.yml | 4 ++-- WORKFLOW.md | 4 ++-- tests/test_release_guards.py | 8 ++++++++ 15 files changed, 34 insertions(+), 23 deletions(-) diff --git a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md index 2b88251a8..b5aa66279 100644 --- a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -45,7 +45,9 @@ project-path inputs among them. Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish - hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. This is where the + hook or a build-nuget hook per output, each uploading `release-asset--`. + The default PyPI leaf uploads one too. + This is where the .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook @@ -66,8 +68,7 @@ Pick by where each artifact *goes*, not by language: The hub default leaf uploads the `pypi-build-` artifact and a `release-asset--pypi` carrying the wheel and sdist. The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload. It runs behind an `environment: pypi` gate and with `skip-existing: true`. - The `id-token: write` permission is granted only at that - one entry point. + The `id-token: write` permission is granted only at that one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes **no** `release-asset-*`. The image set comes from a docker-prepare hook (the hub default emits the diff --git a/.agents/skills/workflow-ci-contract/references/architecture.md b/.agents/skills/workflow-ci-contract/references/architecture.md index 5abdc8f33..d887558d7 100644 --- a/.agents/skills/workflow-ci-contract/references/architecture.md +++ b/.agents/skills/workflow-ci-contract/references/architecture.md @@ -106,7 +106,7 @@ Pick each output's path by **where the artifact goes**: - **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's and PyPI's default leaves also upload a `release-asset-*` carrying the package files. - **Image-registry push** (Docker): the leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes no `release-asset-*`. The arm64 emulation is reserved for the released image. - **Filesystem on a host the project owns** (a static site, a config tree): the leaf builds the tree and ships it to the host. It contributes no `release-asset-*`. The transport is the repo's own. The contract fixes the rest. The deploy is a **separate `workflow_dispatch`** from the release, so a redeploy of an unchanged commit mints no tag. A host rebuild, a rollback, or proving a branch on a non-production environment then costs nothing. Its credentials come from a **per-environment GitHub Environment** rather than the repository secret store. The deploy also ends by asserting **what the host serves** rather than the transport's exit status (D4.6). Retention at the destination is bounded by a declared count, with one side recorded as owning the prune. That side is the deploy where its credential can observe the destination, and the host where that credential is deliberately write-only (D5.6). -- **No file target** (Docker-only, source-only, or PyPI with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). +- **No file target** (Docker-only, source-only, or PyPI-only with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). `WORKFLOW.md` section 3 keeps the architecture. The `workflow-ci-contract` Skill carries this section whole as a generated include, at `.agents/skills/workflow-ci-contract/references/architecture.md` in the hub. That path is not a repo-relative link, since it is hub-local and not carried into every fleet repo. diff --git a/.agents/skills/workflow-ci-contract/references/d-guarantees.md b/.agents/skills/workflow-ci-contract/references/d-guarantees.md index 9fc7ac988..327dd5149 100644 --- a/.agents/skills/workflow-ci-contract/references/d-guarantees.md +++ b/.agents/skills/workflow-ci-contract/references/d-guarantees.md @@ -39,7 +39,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output - **D4.1 Gated single-branch publish.** Output: PRs smoke-test and publish nothing. A **human merge never auto-publishes**. A `plan` job (`publish-plan-task.yml`) decides once. A job downstream of it either gates on the plan's outputs or inherits the skip through `needs:`. A gate on an output compares it against `'true'` rather than testing it bare, since a job output is always a string. A publish runs on a **code-affecting bot push to `main`**, gated to the codegen App / Dependabot `github.actor`. On that trigger, an Actions-only bump matches no release path and publishes nothing. A publish also runs on a **dispatch** of `main`/`develop`, or on a **main-only weekly schedule** (Docker). A source-only repo publishes on dispatch only. The plan reports every `schedule` as a publish, so a publisher with no `push` trigger whose schedule retests and never publishes gates its release itself. Each of its jobs calling `build-release-task.yml` carries `github.event_name == 'workflow_dispatch'` as an `&&` term of its job-level `if:` holding no `||` or negated group. Each run builds one branch. The D4.7 supersede dispatch has one accepted, bounded window that publishes without the allowlist check. - **D4.2 Tag the built commit.** Output: the release `target_commitish` is the built commit's SHA (NBGV's `GitCommitId`), never a branch name or a separately re-resolved ref. *Prevents: the tag landing on the default branch instead of the built tree.* -- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. +- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI-only caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. - **D4.4 No-op republish.** Input: a re-run whose version is unchanged, on a schedule or push trigger. Output: no second release is cut, because the release-create step is skipped when `gh release view` finds a release for the tag. The paired asset-delete is skipped with it. A **dispatch** re-run refreshes the release instead and runs that delete with it. That is why a dispatch-only publisher records this item's skip leg as unreachable rather than failed. Package-registry pushes are no-ops. The NuGet/PyPI publish steps are **not** statically gated on existence. They run and the **server** dedupes (`dotnet nuget push --skip-duplicate` turns a 409 into success, and PyPI does the same under `skip-existing: true`). **Docker always re-pushes** the image (base-image refresh), independently of the release-create skip, within the same run. *Prevents: duplicate releases and wasted pushes.* - **D4.5 A build failure blocks every publish target, within the Docker limit below.** Input: a real publish where one enabled build fails. Output: nothing publishes. The limit applies where a Docker target builds a shared base or more than one image. Its task then pushes the base and each image leg as it builds. So a leg failing after the base or a sibling leg pushed leaves those images in the registry with no release. `github-release` needs every build and carries the same `!failure() && !cancelled()` guard the terminal registry pusher (Docker) does. Without that guard, the implicit `success()` would skip both on every run that disables a target, rather than only on a failed one. A failed build therefore skips the release (no tag, no release). Docker, which needs every other build, skips with it (no image push). By contrast, a **disabled** target, skipped rather than failed, still lets docker push. A package target's separate publish job needs its own gate for the same reason, since it sits outside the `github-release` and Docker `needs:` chains. That gate is that it `needs:` the release-task call, so a failed build skips it with the rest. The push itself is what no gate can cover, because it runs after the whole release task and therefore after `github-release`. It runs there for the trusted-publishing reason `WORKFLOW.md` section 3's "Output Seam by Destination" package-registry bullet gives. So a rejected token exchange, a registry outage, or a trusted-publishing policy naming the wrong workflow file leaves a published release and tag. That release and tag are for a version that never reached the registry. The recovery is a re-dispatch or a full re-run rather than a cleanup. **A full re-run is always available inside its window and is the only route once the branch tip has moved.** The `Re-run failed jobs` shortcut is not a third route here, D5.2's delete having already removed the artifact it would download. `GOVERNANCE.md` "Release Model", and the skill it routes to, carry the mechanics of each route, how to choose, and the window. *Prevents: a partial publish, e.g. a Docker image pushed while .NET publish failed and no release was cut.* - **D4.6 Deploy verification names the release.** Input: a deploy to a filesystem on a host the project owns that completes without error. Output: a check against the running host asserts **which release is answering**, not merely that it answers. The artifact stamps its own version into the configuration it ships, and the check compares that against the version just installed. The check **waits for convergence to a bounded timeout** rather than sampling once. That is because content goes live the instant a pointer moves, while server rules wait on an asynchronous reload. The same check asserts **which environment** answered. That is because several environments serve a byte-identical artifact, and a proxy rule aimed at the wrong one answers healthily under the right hostname. An unreachable host is reported distinctly from an HTTP status. *Prevents: a green deploy over a host still serving the previous release's configuration, and a URL contract checked against the wrong environment. It also prevents a dead config watcher read as a routing fault.* diff --git a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model index ff8e42584..dfb97373c 100644 --- a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model +++ b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model @@ -1 +1 @@ -3cf7617052234183 +0e9cf1db4171544b diff --git a/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract b/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract index 16f93dc50..d798e1bf6 100644 --- a/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract +++ b/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract @@ -1 +1 @@ -6617186e95d921b8 +74c04bf0e5715aa4 diff --git a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md index 2b88251a8..b5aa66279 100644 --- a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -45,7 +45,9 @@ project-path inputs among them. Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish - hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. This is where the + hook or a build-nuget hook per output, each uploading `release-asset--`. + The default PyPI leaf uploads one too. + This is where the .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook @@ -66,8 +68,7 @@ Pick by where each artifact *goes*, not by language: The hub default leaf uploads the `pypi-build-` artifact and a `release-asset--pypi` carrying the wheel and sdist. The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload. It runs behind an `environment: pypi` gate and with `skip-existing: true`. - The `id-token: write` permission is granted only at that - one entry point. + The `id-token: write` permission is granted only at that one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes **no** `release-asset-*`. The image set comes from a docker-prepare hook (the hub default emits the diff --git a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md index 5abdc8f33..d887558d7 100644 --- a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md +++ b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/architecture.md @@ -106,7 +106,7 @@ Pick each output's path by **where the artifact goes**: - **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's and PyPI's default leaves also upload a `release-asset-*` carrying the package files. - **Image-registry push** (Docker): the leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes no `release-asset-*`. The arm64 emulation is reserved for the released image. - **Filesystem on a host the project owns** (a static site, a config tree): the leaf builds the tree and ships it to the host. It contributes no `release-asset-*`. The transport is the repo's own. The contract fixes the rest. The deploy is a **separate `workflow_dispatch`** from the release, so a redeploy of an unchanged commit mints no tag. A host rebuild, a rollback, or proving a branch on a non-production environment then costs nothing. Its credentials come from a **per-environment GitHub Environment** rather than the repository secret store. The deploy also ends by asserting **what the host serves** rather than the transport's exit status (D4.6). Retention at the destination is bounded by a declared count, with one side recorded as owning the prune. That side is the deploy where its credential can observe the destination, and the host where that credential is deliberately write-only (D5.6). -- **No file target** (Docker-only, source-only, or PyPI with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). +- **No file target** (Docker-only, source-only, or PyPI-only with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). `WORKFLOW.md` section 3 keeps the architecture. The `workflow-ci-contract` Skill carries this section whole as a generated include, at `.agents/skills/workflow-ci-contract/references/architecture.md` in the hub. That path is not a repo-relative link, since it is hub-local and not carried into every fleet repo. diff --git a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md index 9fc7ac988..327dd5149 100644 --- a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md +++ b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md @@ -39,7 +39,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output - **D4.1 Gated single-branch publish.** Output: PRs smoke-test and publish nothing. A **human merge never auto-publishes**. A `plan` job (`publish-plan-task.yml`) decides once. A job downstream of it either gates on the plan's outputs or inherits the skip through `needs:`. A gate on an output compares it against `'true'` rather than testing it bare, since a job output is always a string. A publish runs on a **code-affecting bot push to `main`**, gated to the codegen App / Dependabot `github.actor`. On that trigger, an Actions-only bump matches no release path and publishes nothing. A publish also runs on a **dispatch** of `main`/`develop`, or on a **main-only weekly schedule** (Docker). A source-only repo publishes on dispatch only. The plan reports every `schedule` as a publish, so a publisher with no `push` trigger whose schedule retests and never publishes gates its release itself. Each of its jobs calling `build-release-task.yml` carries `github.event_name == 'workflow_dispatch'` as an `&&` term of its job-level `if:` holding no `||` or negated group. Each run builds one branch. The D4.7 supersede dispatch has one accepted, bounded window that publishes without the allowlist check. - **D4.2 Tag the built commit.** Output: the release `target_commitish` is the built commit's SHA (NBGV's `GitCommitId`), never a branch name or a separately re-resolved ref. *Prevents: the tag landing on the default branch instead of the built tree.* -- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. +- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI-only caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. - **D4.4 No-op republish.** Input: a re-run whose version is unchanged, on a schedule or push trigger. Output: no second release is cut, because the release-create step is skipped when `gh release view` finds a release for the tag. The paired asset-delete is skipped with it. A **dispatch** re-run refreshes the release instead and runs that delete with it. That is why a dispatch-only publisher records this item's skip leg as unreachable rather than failed. Package-registry pushes are no-ops. The NuGet/PyPI publish steps are **not** statically gated on existence. They run and the **server** dedupes (`dotnet nuget push --skip-duplicate` turns a 409 into success, and PyPI does the same under `skip-existing: true`). **Docker always re-pushes** the image (base-image refresh), independently of the release-create skip, within the same run. *Prevents: duplicate releases and wasted pushes.* - **D4.5 A build failure blocks every publish target, within the Docker limit below.** Input: a real publish where one enabled build fails. Output: nothing publishes. The limit applies where a Docker target builds a shared base or more than one image. Its task then pushes the base and each image leg as it builds. So a leg failing after the base or a sibling leg pushed leaves those images in the registry with no release. `github-release` needs every build and carries the same `!failure() && !cancelled()` guard the terminal registry pusher (Docker) does. Without that guard, the implicit `success()` would skip both on every run that disables a target, rather than only on a failed one. A failed build therefore skips the release (no tag, no release). Docker, which needs every other build, skips with it (no image push). By contrast, a **disabled** target, skipped rather than failed, still lets docker push. A package target's separate publish job needs its own gate for the same reason, since it sits outside the `github-release` and Docker `needs:` chains. That gate is that it `needs:` the release-task call, so a failed build skips it with the rest. The push itself is what no gate can cover, because it runs after the whole release task and therefore after `github-release`. It runs there for the trusted-publishing reason `WORKFLOW.md` section 3's "Output Seam by Destination" package-registry bullet gives. So a rejected token exchange, a registry outage, or a trusted-publishing policy naming the wrong workflow file leaves a published release and tag. That release and tag are for a version that never reached the registry. The recovery is a re-dispatch or a full re-run rather than a cleanup. **A full re-run is always available inside its window and is the only route once the branch tip has moved.** The `Re-run failed jobs` shortcut is not a third route here, D5.2's delete having already removed the artifact it would download. `GOVERNANCE.md` "Release Model", and the skill it routes to, carry the mechanics of each route, how to choose, and the window. *Prevents: a partial publish, e.g. a Docker image pushed while .NET publish failed and no release was cut.* - **D4.6 Deploy verification names the release.** Input: a deploy to a filesystem on a host the project owns that completes without error. Output: a check against the running host asserts **which release is answering**, not merely that it answers. The artifact stamps its own version into the configuration it ships, and the check compares that against the version just installed. The check **waits for convergence to a bounded timeout** rather than sampling once. That is because content goes live the instant a pointer moves, while server rules wait on an asynchronous reload. The same check asserts **which environment** answered. That is because several environments serve a byte-identical artifact, and a proxy rule aimed at the wrong one answers healthily under the right hostname. An unreachable host is reported distinctly from an HTTP status. *Prevents: a green deploy over a host still serving the previous release's configuration, and a URL contract checked against the wrong environment. It also prevents a dead config watcher read as a routing fault.* diff --git a/.github/actions/pypi-build-default/action.yml b/.github/actions/pypi-build-default/action.yml index f1da12f78..aa068710e 100644 --- a/.github/actions/pypi-build-default/action.yml +++ b/.github/actions/pypi-build-default/action.yml @@ -144,6 +144,6 @@ runs: name: release-asset-${{ inputs.branch }}-pypi path: ${{ inputs.project-dir }}/dist/* if-no-files-found: error - # Consumed within the run by the github-release job, which a caller passing expect_release_assets false skips. - # The short retention bounds what such a caller leaves behind. + # Consumed within the run by the github-release job's download step, which expect_release_assets false skips. + # The short retention bounds what a caller skipping that download leaves behind. retention-days: 1 diff --git a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md index 2b88251a8..b5aa66279 100644 --- a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -45,7 +45,9 @@ project-path inputs among them. Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish - hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. This is where the + hook or a build-nuget hook per output, each uploading `release-asset--`. + The default PyPI leaf uploads one too. + This is where the .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook @@ -66,8 +68,7 @@ Pick by where each artifact *goes*, not by language: The hub default leaf uploads the `pypi-build-` artifact and a `release-asset--pypi` carrying the wheel and sdist. The separate `publish-pypi` job in the caller's own `publish-release.yml` does the OIDC Trusted-Publishing upload. It runs behind an `environment: pypi` gate and with `skip-existing: true`. - The `id-token: write` permission is granted only at that - one entry point. + The `id-token: write` permission is granted only at that one entry point. - **Image-registry pushes** (Docker Hub): `build-docker-task.yml`, hub-hosted like `build-release-task.yml`, pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes **no** `release-asset-*`. The image set comes from a docker-prepare hook (the hub default emits the diff --git a/.github/skills/workflow-ci-contract/references/architecture.md b/.github/skills/workflow-ci-contract/references/architecture.md index 5abdc8f33..d887558d7 100644 --- a/.github/skills/workflow-ci-contract/references/architecture.md +++ b/.github/skills/workflow-ci-contract/references/architecture.md @@ -106,7 +106,7 @@ Pick each output's path by **where the artifact goes**: - **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's and PyPI's default leaves also upload a `release-asset-*` carrying the package files. - **Image-registry push** (Docker): the leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes no `release-asset-*`. The arm64 emulation is reserved for the released image. - **Filesystem on a host the project owns** (a static site, a config tree): the leaf builds the tree and ships it to the host. It contributes no `release-asset-*`. The transport is the repo's own. The contract fixes the rest. The deploy is a **separate `workflow_dispatch`** from the release, so a redeploy of an unchanged commit mints no tag. A host rebuild, a rollback, or proving a branch on a non-production environment then costs nothing. Its credentials come from a **per-environment GitHub Environment** rather than the repository secret store. The deploy also ends by asserting **what the host serves** rather than the transport's exit status (D4.6). Retention at the destination is bounded by a declared count, with one side recorded as owning the prune. That side is the deploy where its credential can observe the destination, and the host where that credential is deliberately write-only (D5.6). -- **No file target** (Docker-only, source-only, or PyPI with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). +- **No file target** (Docker-only, source-only, or PyPI-only with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). `WORKFLOW.md` section 3 keeps the architecture. The `workflow-ci-contract` Skill carries this section whole as a generated include, at `.agents/skills/workflow-ci-contract/references/architecture.md` in the hub. That path is not a repo-relative link, since it is hub-local and not carried into every fleet repo. diff --git a/.github/skills/workflow-ci-contract/references/d-guarantees.md b/.github/skills/workflow-ci-contract/references/d-guarantees.md index 9fc7ac988..327dd5149 100644 --- a/.github/skills/workflow-ci-contract/references/d-guarantees.md +++ b/.github/skills/workflow-ci-contract/references/d-guarantees.md @@ -39,7 +39,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output - **D4.1 Gated single-branch publish.** Output: PRs smoke-test and publish nothing. A **human merge never auto-publishes**. A `plan` job (`publish-plan-task.yml`) decides once. A job downstream of it either gates on the plan's outputs or inherits the skip through `needs:`. A gate on an output compares it against `'true'` rather than testing it bare, since a job output is always a string. A publish runs on a **code-affecting bot push to `main`**, gated to the codegen App / Dependabot `github.actor`. On that trigger, an Actions-only bump matches no release path and publishes nothing. A publish also runs on a **dispatch** of `main`/`develop`, or on a **main-only weekly schedule** (Docker). A source-only repo publishes on dispatch only. The plan reports every `schedule` as a publish, so a publisher with no `push` trigger whose schedule retests and never publishes gates its release itself. Each of its jobs calling `build-release-task.yml` carries `github.event_name == 'workflow_dispatch'` as an `&&` term of its job-level `if:` holding no `||` or negated group. Each run builds one branch. The D4.7 supersede dispatch has one accepted, bounded window that publishes without the allowlist check. - **D4.2 Tag the built commit.** Output: the release `target_commitish` is the built commit's SHA (NBGV's `GitCommitId`), never a branch name or a separately re-resolved ref. *Prevents: the tag landing on the default branch instead of the built tree.* -- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. +- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI-only caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. - **D4.4 No-op republish.** Input: a re-run whose version is unchanged, on a schedule or push trigger. Output: no second release is cut, because the release-create step is skipped when `gh release view` finds a release for the tag. The paired asset-delete is skipped with it. A **dispatch** re-run refreshes the release instead and runs that delete with it. That is why a dispatch-only publisher records this item's skip leg as unreachable rather than failed. Package-registry pushes are no-ops. The NuGet/PyPI publish steps are **not** statically gated on existence. They run and the **server** dedupes (`dotnet nuget push --skip-duplicate` turns a 409 into success, and PyPI does the same under `skip-existing: true`). **Docker always re-pushes** the image (base-image refresh), independently of the release-create skip, within the same run. *Prevents: duplicate releases and wasted pushes.* - **D4.5 A build failure blocks every publish target, within the Docker limit below.** Input: a real publish where one enabled build fails. Output: nothing publishes. The limit applies where a Docker target builds a shared base or more than one image. Its task then pushes the base and each image leg as it builds. So a leg failing after the base or a sibling leg pushed leaves those images in the registry with no release. `github-release` needs every build and carries the same `!failure() && !cancelled()` guard the terminal registry pusher (Docker) does. Without that guard, the implicit `success()` would skip both on every run that disables a target, rather than only on a failed one. A failed build therefore skips the release (no tag, no release). Docker, which needs every other build, skips with it (no image push). By contrast, a **disabled** target, skipped rather than failed, still lets docker push. A package target's separate publish job needs its own gate for the same reason, since it sits outside the `github-release` and Docker `needs:` chains. That gate is that it `needs:` the release-task call, so a failed build skips it with the rest. The push itself is what no gate can cover, because it runs after the whole release task and therefore after `github-release`. It runs there for the trusted-publishing reason `WORKFLOW.md` section 3's "Output Seam by Destination" package-registry bullet gives. So a rejected token exchange, a registry outage, or a trusted-publishing policy naming the wrong workflow file leaves a published release and tag. That release and tag are for a version that never reached the registry. The recovery is a re-dispatch or a full re-run rather than a cleanup. **A full re-run is always available inside its window and is the only route once the branch tip has moved.** The `Re-run failed jobs` shortcut is not a third route here, D5.2's delete having already removed the artifact it would download. `GOVERNANCE.md` "Release Model", and the skill it routes to, carry the mechanics of each route, how to choose, and the window. *Prevents: a partial publish, e.g. a Docker image pushed while .NET publish failed and no release was cut.* - **D4.6 Deploy verification names the release.** Input: a deploy to a filesystem on a host the project owns that completes without error. Output: a check against the running host asserts **which release is answering**, not merely that it answers. The artifact stamps its own version into the configuration it ships, and the check compares that against the version just installed. The check **waits for convergence to a bounded timeout** rather than sampling once. That is because content goes live the instant a pointer moves, while server rules wait on an asynchronous reload. The same check asserts **which environment** answered. That is because several environments serve a byte-identical artifact, and a proxy rule aimed at the wrong one answers healthily under the right hostname. An unreachable host is reported distinctly from an HTTP status. *Prevents: a green deploy over a host still serving the previous release's configuration, and a URL contract checked against the wrong environment. It also prevents a dead config watcher read as a routing fault.* diff --git a/.github/workflows/build-release-task.yml b/.github/workflows/build-release-task.yml index 58b2dcff8..cec53ff0d 100644 --- a/.github/workflows/build-release-task.yml +++ b/.github/workflows/build-release-task.yml @@ -4,7 +4,7 @@ name: Build project release task # NBGV runs once in get-version and threads the version to every target. # The validate-release job gates branch<->version consistency once before any build or publish. # The github-release job is verbatim in shape: pattern download, exists gate, target_commitish, consume-then-delete. -# The expect_release_assets input collapses the fleet's no-asset release shapes (Docker-only, source-only, a PyPI caller whose own hook uploads no asset) into one flag. +# The expect_release_assets input collapses the fleet's no-asset release shapes (Docker-only, source-only, a PyPI-only caller whose own hook uploads no asset) into one flag. # # Each build target uses a caller hook or the hub default for that target. # The one exception is build-release-asset, a file target the hub cannot know, whose caller hook is required. @@ -65,7 +65,7 @@ on: default: false # Set false for a repo that produces no release-asset-* files, such as a Docker-only or source-only one. # A NuGet or PyPI caller on the hub default leaf keeps the default, since that leaf uploads a release-asset--nuget or -pypi carrying the package files. - # A PyPI caller whose own build-pypi hook uploads no release-asset-* sets it false. + # A PyPI-only caller whose own build-pypi hook uploads no release-asset-* sets it false. # The release is then just the tag + source zip + README + LICENSE. # The artifact download is skipped and the unmatched-files guard relaxes. expect_release_assets: diff --git a/WORKFLOW.md b/WORKFLOW.md index c9e75b80a..ffb70b4c0 100644 --- a/WORKFLOW.md +++ b/WORKFLOW.md @@ -129,7 +129,7 @@ Pick each output's path by **where the artifact goes**: - **Package-registry push** (NuGet, PyPI): the leaf builds and uploads a build artifact (`nuget-build-` / `pypi-build-`). A separate `publish-` job in the **publishing repository's own** publisher consumes it and pushes. Each registry publishes through OIDC Trusted Publishing, never a stored API key, and that push sits outside the leaf for the reasons that follow. Trusted publishing validates the OIDC token's `job_workflow_ref` claim, which names the workflow the job actually ran from. So a push made from a reusable workflow a *different* repository hosts is rejected at the token exchange. There NuGet.org answers `HTTP 401` with `does not start with //.github/workflows/`. That alone rules out a leaf another repository hosts. A leaf this repository hosts clears the claim, and the split still applies to it. That is because a called job declaring no `permissions:` runs under the calling job's whole grant. So a push anywhere inside the release task would put `id-token: write` on every job in it, rather than at the one entry point D7.2 requires. The registered trusted-publishing policy therefore names the publisher, `publish-release.yml`. PyPI additionally gates its publish job behind an environment. NuGet.org binds its policy to the workflow file rather than to an environment and needs none. NuGet's and PyPI's default leaves also upload a `release-asset-*` carrying the package files. - **Image-registry push** (Docker): the leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, and contributes no `release-asset-*`. The arm64 emulation is reserved for the released image. - **Filesystem on a host the project owns** (a static site, a config tree): the leaf builds the tree and ships it to the host. It contributes no `release-asset-*`. The transport is the repo's own. The contract fixes the rest. The deploy is a **separate `workflow_dispatch`** from the release, so a redeploy of an unchanged commit mints no tag. A host rebuild, a rollback, or proving a branch on a non-production environment then costs nothing. Its credentials come from a **per-environment GitHub Environment** rather than the repository secret store. The deploy also ends by asserting **what the host serves** rather than the transport's exit status (D4.6). Retention at the destination is bounded by a declared count, with one side recorded as owning the prune. That side is the deploy where its credential can observe the destination, and the host where that credential is deliberately write-only (D5.6). -- **No file target** (Docker-only, source-only, or PyPI with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). +- **No file target** (Docker-only, source-only, or PyPI-only with a no-asset hook): the release is tag + source zip + README + LICENSE. The caller **MUST pass `expect_release_assets: false`** to the release task. A publisher with file targets retains the default `true`. This setting is caller-specific. The default `true` fails on `fail_on_unmatched_files` when no assets exist. A **source-only** repo also passes every `enable_*` input as false because it has no build leaf (see `WORKFLOW.md` section 6). `WORKFLOW.md` section 3 keeps the architecture. The `workflow-ci-contract` Skill carries this section whole as a generated include, at `.agents/skills/workflow-ci-contract/references/architecture.md` in the hub. That path is not a repo-relative link, since it is hub-local and not carried into every fleet repo. @@ -168,7 +168,7 @@ The required behaviors, organized by domain. Each is a **MUST**, and its `Output - **D4.1 Gated single-branch publish.** Output: PRs smoke-test and publish nothing. A **human merge never auto-publishes**. A `plan` job (`publish-plan-task.yml`) decides once. A job downstream of it either gates on the plan's outputs or inherits the skip through `needs:`. A gate on an output compares it against `'true'` rather than testing it bare, since a job output is always a string. A publish runs on a **code-affecting bot push to `main`**, gated to the codegen App / Dependabot `github.actor`. On that trigger, an Actions-only bump matches no release path and publishes nothing. A publish also runs on a **dispatch** of `main`/`develop`, or on a **main-only weekly schedule** (Docker). A source-only repo publishes on dispatch only. The plan reports every `schedule` as a publish, so a publisher with no `push` trigger whose schedule retests and never publishes gates its release itself. Each of its jobs calling `build-release-task.yml` carries `github.event_name == 'workflow_dispatch'` as an `&&` term of its job-level `if:` holding no `||` or negated group. Each run builds one branch. The D4.7 supersede dispatch has one accepted, bounded window that publishes without the allowlist check. - **D4.2 Tag the built commit.** Output: the release `target_commitish` is the built commit's SHA (NBGV's `GitCommitId`), never a branch name or a separately re-resolved ref. *Prevents: the tag landing on the default branch instead of the built tree.* -- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. +- **D4.3 Release contents.** Output: every release contains a tag on the built commit plus the auto source zip, README, and LICENSE. File targets attach `release-asset-*`. The `prerelease` value equals `branch != default`. A no-file-target caller sets `expect_release_assets: false` to reach the no-asset shape. This applies to Docker-only and source-only repos, and to a PyPI-only caller whose own `build-pypi` hook uploads none. A NuGet or PyPI target on the hub default leaf is not among them. That leaf uploads a `release-asset-*` carrying the package files, so such a caller keeps the default `true`. The setting relaxes `fail_on_unmatched_files` and skips the asset download. The release-create step fails when no assets exist and the setting retains its default `true`. A source-only caller also sets every `enable_*` input false. - **D4.4 No-op republish.** Input: a re-run whose version is unchanged, on a schedule or push trigger. Output: no second release is cut, because the release-create step is skipped when `gh release view` finds a release for the tag. The paired asset-delete is skipped with it. A **dispatch** re-run refreshes the release instead and runs that delete with it. That is why a dispatch-only publisher records this item's skip leg as unreachable rather than failed. Package-registry pushes are no-ops. The NuGet/PyPI publish steps are **not** statically gated on existence. They run and the **server** dedupes (`dotnet nuget push --skip-duplicate` turns a 409 into success, and PyPI does the same under `skip-existing: true`). **Docker always re-pushes** the image (base-image refresh), independently of the release-create skip, within the same run. *Prevents: duplicate releases and wasted pushes.* - **D4.5 A build failure blocks every publish target, within the Docker limit below.** Input: a real publish where one enabled build fails. Output: nothing publishes. The limit applies where a Docker target builds a shared base or more than one image. Its task then pushes the base and each image leg as it builds. So a leg failing after the base or a sibling leg pushed leaves those images in the registry with no release. `github-release` needs every build and carries the same `!failure() && !cancelled()` guard the terminal registry pusher (Docker) does. Without that guard, the implicit `success()` would skip both on every run that disables a target, rather than only on a failed one. A failed build therefore skips the release (no tag, no release). Docker, which needs every other build, skips with it (no image push). By contrast, a **disabled** target, skipped rather than failed, still lets docker push. A package target's separate publish job needs its own gate for the same reason, since it sits outside the `github-release` and Docker `needs:` chains. That gate is that it `needs:` the release-task call, so a failed build skips it with the rest. The push itself is what no gate can cover, because it runs after the whole release task and therefore after `github-release`. It runs there for the trusted-publishing reason `WORKFLOW.md` section 3's "Output Seam by Destination" package-registry bullet gives. So a rejected token exchange, a registry outage, or a trusted-publishing policy naming the wrong workflow file leaves a published release and tag. That release and tag are for a version that never reached the registry. The recovery is a re-dispatch or a full re-run rather than a cleanup. **A full re-run is always available inside its window and is the only route once the branch tip has moved.** The `Re-run failed jobs` shortcut is not a third route here, D5.2's delete having already removed the artifact it would download. `GOVERNANCE.md` "Release Model", and the skill it routes to, carry the mechanics of each route, how to choose, and the window. *Prevents: a partial publish, e.g. a Docker image pushed while .NET publish failed and no release was cut.* - **D4.6 Deploy verification names the release.** Input: a deploy to a filesystem on a host the project owns that completes without error. Output: a check against the running host asserts **which release is answering**, not merely that it answers. The artifact stamps its own version into the configuration it ships, and the check compares that against the version just installed. The check **waits for convergence to a bounded timeout** rather than sampling once. That is because content goes live the instant a pointer moves, while server rules wait on an asynchronous reload. The same check asserts **which environment** answered. That is because several environments serve a byte-identical artifact, and a proxy rule aimed at the wrong one answers healthily under the right hostname. An unreachable host is reported distinctly from an HTTP status. *Prevents: a green deploy over a host still serving the previous release's configuration, and a URL contract checked against the wrong environment. It also prevents a dead config watcher read as a routing fault.* diff --git a/tests/test_release_guards.py b/tests/test_release_guards.py index f163fdce7..cb1ae33a6 100755 --- a/tests/test_release_guards.py +++ b/tests/test_release_guards.py @@ -653,6 +653,14 @@ def test_default_leaves_upload_a_smoke_gated_release_asset(self) -> None: self.assertEqual("${{ inputs.project-dir }}/dist/*", yaml_value(pypi, "with", "path")) self.assertEqual("error", yaml_value(pypi, "with", "if-no-files-found")) + # Without merge-multiple the files land in a per-artifact subdirectory that ./Publish/* never attaches as files. + task = (REPO / ".github/workflows/build-release-task.yml").read_text(encoding="utf-8") + download = yaml_step(task, "Download release asset artifacts step") + self.assertEqual( + "release-asset-${{ inputs.branch }}-*", yaml_value(download, "with", "pattern") + ) + self.assertEqual("true", yaml_value(download, "with", "merge-multiple")) + def test_nuget_artifact_name_matches_contracts_and_consumers(self) -> None: canonical_name = "nuget-build-" legacy_name = "nuget-push" + "-default" From c9747e24b8786b2400424873286468f81e6a0712 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 3 Dec 2026 07:02:23 -0800 Subject: [PATCH 5/7] Keep the PyPI Release Asset Sentence Apart From the NET Build Sentence Part of #4609 Co-Authored-By: Claude Sonnet 5.5 --- .../references/release-publish-mechanics.md | 4 ++-- .../fleet-skills/.source-digests/branching-and-release-model | 2 +- .../references/release-publish-mechanics.md | 4 ++-- .../references/release-publish-mechanics.md | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md index b5aa66279..a59703dd1 100644 --- a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,8 +47,8 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - This is where the - .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit + The .NET `dotnet publish` or `dotnet build` lives in the first kind, though a package push does not. + The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides diff --git a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model index dfb97373c..a0a9add67 100644 --- a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model +++ b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model @@ -1 +1 @@ -0e9cf1db4171544b +245d7d73b769a544 diff --git a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md index b5aa66279..a59703dd1 100644 --- a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,8 +47,8 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - This is where the - .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit + The .NET `dotnet publish` or `dotnet build` lives in the first kind, though a package push does not. + The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides diff --git a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md index b5aa66279..a59703dd1 100644 --- a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,8 +47,8 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - This is where the - .NET `dotnet publish` or `dotnet build` lives, though a package push does not. The hub default takes an explicit + The .NET `dotnet publish` or `dotnet build` lives in the first kind, though a package push does not. + The hub default takes an explicit project path, and a project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides From 10ea6fc4fef9fe9e066f6c87b76048bb581f8c78 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 3 Dec 2026 07:07:17 -0800 Subject: [PATCH 6/7] Correct the PyPI Release Asset Wording Across the Contract and Docs Part of #4609 Co-Authored-By: Claude Sonnet 5.5 --- .../references/release-publish-mechanics.md | 6 +++--- .../workflow-ci-contract/references/test-methodology.md | 2 +- .../.source-digests/branching-and-release-model | 2 +- .../fleet-skills/.source-digests/workflow-ci-contract | 2 +- .../references/release-publish-mechanics.md | 6 +++--- .../workflow-ci-contract/references/test-methodology.md | 2 +- .github/actions/pypi-build-default/action.yml | 3 ++- .../references/release-publish-mechanics.md | 6 +++--- .../workflow-ci-contract/references/test-methodology.md | 2 +- .github/workflows/build-release-task.yml | 2 +- WORKFLOW.md | 4 ++-- docs/reusable-workflows.md | 2 +- 12 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md index a59703dd1..8013eca43 100644 --- a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,9 +47,9 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - The .NET `dotnet publish` or `dotnet build` lives in the first kind, though a package push does not. - The hub default takes an explicit - project path, and a project needing different build behavior replaces the hook. A data-only + The .NET `dotnet publish` or `dotnet build` lives in the dotnet-publish hook, though a package push does not. + The hub default takes an explicit project path. + A project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides `.github/actions/build-release-asset/action.yml` and the task fails without it. diff --git a/.agents/skills/workflow-ci-contract/references/test-methodology.md b/.agents/skills/workflow-ci-contract/references/test-methodology.md index 2e88b46d5..6381fc559 100644 --- a/.agents/skills/workflow-ci-contract/references/test-methodology.md +++ b/.agents/skills/workflow-ci-contract/references/test-methodology.md @@ -41,7 +41,7 @@ For each *applicable* scenario, evaluate every job's `if:`/`needs:` against the | S13 | deploy dispatch of a production environment from a non-default ref | **fails fast**, before anything is installed or written | D2.1 | | S14 | publish whose branch head gained different `.github/workflows` content after the build began | every update since a release bot's push or merge: release-create **skipped** and the publisher dispatched on the branch. In that case this run ends **cancelled** with its package publish jobs skipped (a Docker image already pushed). The dispatched run releases the head, queueing behind this run only where the head's publisher evaluates this run's group for a dispatch. A push landing after the branch is confirmed unmoved and before the dispatch is released as if it were such an update. That is an accepted, bounded limit per D4.7. Any other update: the step **fails**, nothing is released or dispatched | D4.1, D4.2, D4.5, D4.7 | | S15 | a smoke or publish run whose `build-nuget` job runs the hub default leaf, for a project declaring `net10.0;net11.0`. The package holds one framework's assembly under both `lib/` folders | the job plans both runtime lines, installs them, and consumes the package once per framework. It **fails** on the `TargetFrameworkAttribute` of the `lib/` folder holding the other framework's assembly, after reporting every other row. A correct package **passes**. The check uploads nothing in either run. A publish run's leaf has uploaded its artifacts already, and a failure leaves them to their retention and the dependent publish job **skipped** | D1.3, D1.7 | -| S16 | a smoke or publish run whose `build-pypi` job runs the hub default leaf, for a project with a `tests/` folder and a `python-versions` of `["3.13", "3.14"]`. Its wheel leaves out a module the tests import | the job builds, then consumes the wheel and the sdist under each line. It **fails** on the tests row of each artifact lacking the module, after reporting every other row. A correct package **passes** under both lines. The check uploads nothing in either run. A publish run's leaf has uploaded its artifact already. A failure leaves it to its retention, and the dependent publish job is **skipped** | D1.3, D1.8 | +| S16 | a smoke or publish run whose `build-pypi` job runs the hub default leaf, for a project with a `tests/` folder and a `python-versions` of `["3.13", "3.14"]`. Its wheel leaves out a module the tests import | the job builds, then consumes the wheel and the sdist under each line. It **fails** on the tests row of each artifact lacking the module, after reporting every other row. A correct package **passes** under both lines. The check uploads nothing in either run. A publish run's leaf has uploaded its artifacts already. A failure leaves them to their retention, and the dependent publish job is **skipped** | D1.3, D1.8 | ### 5C. Live Probe (Where Warranted) diff --git a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model index a0a9add67..55fd90630 100644 --- a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model +++ b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model @@ -1 +1 @@ -245d7d73b769a544 +a58b8142b59ef18e diff --git a/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract b/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract index d798e1bf6..4553344d0 100644 --- a/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract +++ b/.claude-plugin/fleet-skills/.source-digests/workflow-ci-contract @@ -1 +1 @@ -74c04bf0e5715aa4 +750bae5d66dc9c1d diff --git a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md index a59703dd1..8013eca43 100644 --- a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,9 +47,9 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - The .NET `dotnet publish` or `dotnet build` lives in the first kind, though a package push does not. - The hub default takes an explicit - project path, and a project needing different build behavior replaces the hook. A data-only + The .NET `dotnet publish` or `dotnet build` lives in the dotnet-publish hook, though a package push does not. + The hub default takes an explicit project path. + A project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides `.github/actions/build-release-asset/action.yml` and the task fails without it. diff --git a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/test-methodology.md b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/test-methodology.md index 2e88b46d5..6381fc559 100644 --- a/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/test-methodology.md +++ b/.claude-plugin/fleet-skills/skills/workflow-ci-contract/references/test-methodology.md @@ -41,7 +41,7 @@ For each *applicable* scenario, evaluate every job's `if:`/`needs:` against the | S13 | deploy dispatch of a production environment from a non-default ref | **fails fast**, before anything is installed or written | D2.1 | | S14 | publish whose branch head gained different `.github/workflows` content after the build began | every update since a release bot's push or merge: release-create **skipped** and the publisher dispatched on the branch. In that case this run ends **cancelled** with its package publish jobs skipped (a Docker image already pushed). The dispatched run releases the head, queueing behind this run only where the head's publisher evaluates this run's group for a dispatch. A push landing after the branch is confirmed unmoved and before the dispatch is released as if it were such an update. That is an accepted, bounded limit per D4.7. Any other update: the step **fails**, nothing is released or dispatched | D4.1, D4.2, D4.5, D4.7 | | S15 | a smoke or publish run whose `build-nuget` job runs the hub default leaf, for a project declaring `net10.0;net11.0`. The package holds one framework's assembly under both `lib/` folders | the job plans both runtime lines, installs them, and consumes the package once per framework. It **fails** on the `TargetFrameworkAttribute` of the `lib/` folder holding the other framework's assembly, after reporting every other row. A correct package **passes**. The check uploads nothing in either run. A publish run's leaf has uploaded its artifacts already, and a failure leaves them to their retention and the dependent publish job **skipped** | D1.3, D1.7 | -| S16 | a smoke or publish run whose `build-pypi` job runs the hub default leaf, for a project with a `tests/` folder and a `python-versions` of `["3.13", "3.14"]`. Its wheel leaves out a module the tests import | the job builds, then consumes the wheel and the sdist under each line. It **fails** on the tests row of each artifact lacking the module, after reporting every other row. A correct package **passes** under both lines. The check uploads nothing in either run. A publish run's leaf has uploaded its artifact already. A failure leaves it to its retention, and the dependent publish job is **skipped** | D1.3, D1.8 | +| S16 | a smoke or publish run whose `build-pypi` job runs the hub default leaf, for a project with a `tests/` folder and a `python-versions` of `["3.13", "3.14"]`. Its wheel leaves out a module the tests import | the job builds, then consumes the wheel and the sdist under each line. It **fails** on the tests row of each artifact lacking the module, after reporting every other row. A correct package **passes** under both lines. The check uploads nothing in either run. A publish run's leaf has uploaded its artifacts already. A failure leaves them to their retention, and the dependent publish job is **skipped** | D1.3, D1.8 | ### 5C. Live Probe (Where Warranted) diff --git a/.github/actions/pypi-build-default/action.yml b/.github/actions/pypi-build-default/action.yml index aa068710e..198c75bbb 100644 --- a/.github/actions/pypi-build-default/action.yml +++ b/.github/actions/pypi-build-default/action.yml @@ -136,7 +136,8 @@ runs: retention-days: 1 # GitHub-release asset, uploaded under the release-asset-- pattern the github-release job collects. - # The wheel and sdist go up unzipped, so the release attaches the files directly, since the job downloads with merge-multiple. + # The wheel and sdist go up as bare files, so the release attaches them directly. + # That holds because the job downloads with merge-multiple. - name: Upload release asset step if: ${{ inputs.smoke != 'true' }} uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 diff --git a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md index a59703dd1..8013eca43 100644 --- a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,9 +47,9 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - The .NET `dotnet publish` or `dotnet build` lives in the first kind, though a package push does not. - The hub default takes an explicit - project path, and a project needing different build behavior replaces the hook. A data-only + The .NET `dotnet publish` or `dotnet build` lives in the dotnet-publish hook, though a package push does not. + The hub default takes an explicit project path. + A project needing different build behavior replaces the hook. A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides `.github/actions/build-release-asset/action.yml` and the task fails without it. diff --git a/.github/skills/workflow-ci-contract/references/test-methodology.md b/.github/skills/workflow-ci-contract/references/test-methodology.md index 2e88b46d5..6381fc559 100644 --- a/.github/skills/workflow-ci-contract/references/test-methodology.md +++ b/.github/skills/workflow-ci-contract/references/test-methodology.md @@ -41,7 +41,7 @@ For each *applicable* scenario, evaluate every job's `if:`/`needs:` against the | S13 | deploy dispatch of a production environment from a non-default ref | **fails fast**, before anything is installed or written | D2.1 | | S14 | publish whose branch head gained different `.github/workflows` content after the build began | every update since a release bot's push or merge: release-create **skipped** and the publisher dispatched on the branch. In that case this run ends **cancelled** with its package publish jobs skipped (a Docker image already pushed). The dispatched run releases the head, queueing behind this run only where the head's publisher evaluates this run's group for a dispatch. A push landing after the branch is confirmed unmoved and before the dispatch is released as if it were such an update. That is an accepted, bounded limit per D4.7. Any other update: the step **fails**, nothing is released or dispatched | D4.1, D4.2, D4.5, D4.7 | | S15 | a smoke or publish run whose `build-nuget` job runs the hub default leaf, for a project declaring `net10.0;net11.0`. The package holds one framework's assembly under both `lib/` folders | the job plans both runtime lines, installs them, and consumes the package once per framework. It **fails** on the `TargetFrameworkAttribute` of the `lib/` folder holding the other framework's assembly, after reporting every other row. A correct package **passes**. The check uploads nothing in either run. A publish run's leaf has uploaded its artifacts already, and a failure leaves them to their retention and the dependent publish job **skipped** | D1.3, D1.7 | -| S16 | a smoke or publish run whose `build-pypi` job runs the hub default leaf, for a project with a `tests/` folder and a `python-versions` of `["3.13", "3.14"]`. Its wheel leaves out a module the tests import | the job builds, then consumes the wheel and the sdist under each line. It **fails** on the tests row of each artifact lacking the module, after reporting every other row. A correct package **passes** under both lines. The check uploads nothing in either run. A publish run's leaf has uploaded its artifact already. A failure leaves it to its retention, and the dependent publish job is **skipped** | D1.3, D1.8 | +| S16 | a smoke or publish run whose `build-pypi` job runs the hub default leaf, for a project with a `tests/` folder and a `python-versions` of `["3.13", "3.14"]`. Its wheel leaves out a module the tests import | the job builds, then consumes the wheel and the sdist under each line. It **fails** on the tests row of each artifact lacking the module, after reporting every other row. A correct package **passes** under both lines. The check uploads nothing in either run. A publish run's leaf has uploaded its artifacts already. A failure leaves them to their retention, and the dependent publish job is **skipped** | D1.3, D1.8 | ### 5C. Live Probe (Where Warranted) diff --git a/.github/workflows/build-release-task.yml b/.github/workflows/build-release-task.yml index cec53ff0d..d52597f6a 100644 --- a/.github/workflows/build-release-task.yml +++ b/.github/workflows/build-release-task.yml @@ -488,7 +488,7 @@ jobs: # A skipped needs job still lets this job run, since it only needs a real, non-smoke publish. # The release step guards fail_on_unmatched_files: true, so at least one release-asset-* must match. # A repo that drops every file-producing target relaxes that guard. - # A Docker-only repo is the case, its release carrying only the source zip + README + LICENSE. + # A Docker-only or source-only repo is the case, its release carrying only the source zip + README + LICENSE. - name: Download release asset artifacts step if: ${{ inputs.expect_release_assets }} uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 diff --git a/WORKFLOW.md b/WORKFLOW.md index ffb70b4c0..b43759e9a 100644 --- a/WORKFLOW.md +++ b/WORKFLOW.md @@ -253,7 +253,7 @@ For each *applicable* scenario, evaluate every job's `if:`/`needs:` against the | S13 | deploy dispatch of a production environment from a non-default ref | **fails fast**, before anything is installed or written | D2.1 | | S14 | publish whose branch head gained different `.github/workflows` content after the build began | every update since a release bot's push or merge: release-create **skipped** and the publisher dispatched on the branch. In that case this run ends **cancelled** with its package publish jobs skipped (a Docker image already pushed). The dispatched run releases the head, queueing behind this run only where the head's publisher evaluates this run's group for a dispatch. A push landing after the branch is confirmed unmoved and before the dispatch is released as if it were such an update. That is an accepted, bounded limit per D4.7. Any other update: the step **fails**, nothing is released or dispatched | D4.1, D4.2, D4.5, D4.7 | | S15 | a smoke or publish run whose `build-nuget` job runs the hub default leaf, for a project declaring `net10.0;net11.0`. The package holds one framework's assembly under both `lib/` folders | the job plans both runtime lines, installs them, and consumes the package once per framework. It **fails** on the `TargetFrameworkAttribute` of the `lib/` folder holding the other framework's assembly, after reporting every other row. A correct package **passes**. The check uploads nothing in either run. A publish run's leaf has uploaded its artifacts already, and a failure leaves them to their retention and the dependent publish job **skipped** | D1.3, D1.7 | -| S16 | a smoke or publish run whose `build-pypi` job runs the hub default leaf, for a project with a `tests/` folder and a `python-versions` of `["3.13", "3.14"]`. Its wheel leaves out a module the tests import | the job builds, then consumes the wheel and the sdist under each line. It **fails** on the tests row of each artifact lacking the module, after reporting every other row. A correct package **passes** under both lines. The check uploads nothing in either run. A publish run's leaf has uploaded its artifact already. A failure leaves it to its retention, and the dependent publish job is **skipped** | D1.3, D1.8 | +| S16 | a smoke or publish run whose `build-pypi` job runs the hub default leaf, for a project with a `tests/` folder and a `python-versions` of `["3.13", "3.14"]`. Its wheel leaves out a module the tests import | the job builds, then consumes the wheel and the sdist under each line. It **fails** on the tests row of each artifact lacking the module, after reporting every other row. A correct package **passes** under both lines. The check uploads nothing in either run. A publish run's leaf has uploaded its artifacts already. A failure leaves them to their retention, and the dependent publish job is **skipped** | D1.3, D1.8 | ### 5C. Live Probe (Where Warranted) @@ -301,7 +301,7 @@ What each type adds beyond that, and how its leaf behaves, is below. - **`dotnet-publish`.** The target runs a sequential `dotnet publish` runtime loop inside one composite-action job. Configuration is Release on the default branch and Debug otherwise. A non-smoke run builds the full runtime set, archives the combined output as a `.7z`, and uploads it as `release-asset--dotnet-publish`. The archive is named from the project file stem unless `dotnet_publish_asset_name` overrides it. A smoke run builds a **strict, non-empty subset** of that runtime set and skips the archive and upload steps, so it uploads nothing. S1 smoke-builds that subset after a .NET project change. S7 attaches the 7z from a non-smoke run. The non-default leg sets `prerelease=true`, and the default leg sets `prerelease=false`. GitHub marks the stable default release "Latest" automatically. - **`nuget`.** The leaf uploads both `release-asset--nuget` and `nuget-build-` on a non-smoke run and pushes nothing. A separate `publish-nuget` job in the repo's own publisher consumes the second and runs `dotnet nuget push *.nupkg --skip-duplicate`. It then deletes that artifact under the download step's own success (D5.2). Section 3's `Output Seam by Destination` says why the push sits there rather than in the leaf. Configuration is Release on the default branch, Debug otherwise. The default leaf is followed by the D1.7 package consume check in smoke and publish runs alike. A caller's own `build-nuget` hook is outside it. The release-asset `.7z` carries the packages alone, never the loose build output, since each package already holds every target framework's build under its own `lib//`. Where symbols are enabled (`snupkg`), the push auto-carries the paired `.snupkg` to NuGet.org's symbol server and the release-asset `.7z` also contains it, a triple surface. NuGet.org derives `isPrerelease` from the SemVer2 `-g` suffix (the workflow sets no such flag). Test: S15 consumes the package per framework. S7 non-default leg publishes a prerelease package + asset, default a stable. S9 re-run is a server-side `--skip-duplicate` no-op. 5C: query NuGet.org for both versions and the symbol package. -- **`pypi`.** The leaf uploads `release-asset--pypi` and `pypi-build-` on a non-smoke run. The first carries the wheel and sdist unzipped, so the release attaches the files directly. A **separate** `publish-pypi` job (with `environment: pypi`, `id-token: write`, `actions: write`) does the OIDC Trusted-Publishing upload with `skip-existing: true`. It then **consume-then-deletes** the build artifact under the download step's own success (D5.2). So on S9 the build artifact is deleted even though the `release-asset-*` delete is skipped. The version is the `X.Y.Z` core of `SemVer2` with `.dev0` appended on `develop` only, per D3.4. The default leaf is followed by the D1.8 package consume check in smoke and publish runs alike. A caller's own `build-pypi` hook is outside it. A PyPI-only repo on the default leaf keeps `expect_release_assets` true, and one whose own `build-pypi` hook uploads no `release-asset-*` sets it false. Test: S16 consumes the wheel and the sdist per Python line. S7 default leg publishes a release, non-default a `.dev0`, and the release carries the wheel and the sdist. S9 is a `skip-existing` no-op. 5C inspects the `dist/*` filenames and the compute-version log. +- **`pypi`.** The leaf uploads `release-asset--pypi` and `pypi-build-` on a non-smoke run. The first carries the wheel and sdist as bare files, so the release attaches them directly. A **separate** `publish-pypi` job (with `environment: pypi`, `id-token: write`, `actions: write`) does the OIDC Trusted-Publishing upload with `skip-existing: true`. It then **consume-then-deletes** the build artifact under the download step's own success (D5.2). So on S9 the build artifact is deleted even though the `release-asset-*` delete is skipped. The version is the `X.Y.Z` core of `SemVer2` with `.dev0` appended on `develop` only, per D3.4. The default leaf is followed by the D1.8 package consume check in smoke and publish runs alike. A caller's own `build-pypi` hook is outside it. A PyPI-only repo on the default leaf keeps `expect_release_assets` true, and one whose own `build-pypi` hook uploads no `release-asset-*` sets it false. Test: S16 consumes the wheel and the sdist per Python line. S7 default leg publishes a release, non-default a `.dev0`, and the release carries the wheel and the sdist. S9 is a `skip-existing` no-op. 5C inspects the `dist/*` filenames and the compute-version log. - **`docker`.** The leaf pushes the default branch multi-arch (amd64+arm64) and any other branch `amd64`-only, with a per-branch registry buildcache. A single-image repo caches to `:buildcache-`. A multi-image repo varies the cache **repository** rather than the tag, `:buildcache-` for each image, since the tag alone cannot distinguish two images. `cache-to` writes only the built branch and only on push, and `cache-from` reads both branches. It contributes no `release-asset-*`, so a Docker-only repo's caller passes `expect_release_assets: false`. The readme job (`peter-evans/dockerhub-description`, `DOCKER_HUB_ACCESS_TOKEN`) runs **only** when the default branch publishes, whether called directly or reached through the hub-hosted `publish-docker-readme-task.yml`. Where the Docker Hub overview differs from the project README, the repo publishes a `Docker/README.md` through that task, the Hub description being size-limited. The docker-readme task validates its two mutually-exclusive input sources, `repositories` against `manifest`+`manifest-jq`. It defaults to the calling repository where neither is supplied. A multi-image repo derives its publish matrix from the manifest. Docker **always re-pushes** the image, independently of a skipped release-create (S9). The tests that follow assume the default tag matrix, which a caller-supplied `matrix` or `docker-prepare` hook replaces. Test: S7 default leg pushes `latest` + the version tag and updates the readme. Non-default pushes `develop` + the version tag (amd64 only). S9 still re-pushes. 5C Docker probe needs `DOCKER_HUB_*` secrets and same-repo (not fork) runs. - **`library` (a worked example, not a fleet type).** No such leaf ships, so this row walks D6.4's add-a-target procedure rather than an existing shape. The target is a single new leaf that validates, zips, and uploads `release-asset--library` (`retention-days: 1` per D5.4, upload gated on smoke being false per D1.3). Adding it means a new `enable_library` input, and a `build-library` job and its `github-release` and `build-docker` `needs:` entries, in the release task. In the PR workflow it means a `library` paths-filter entry, `changes` output, and `smoke-build` enable-forward. Without that last one, D1.1 never smoke-builds the library. In the publisher, it means the `enable_library` value the publisher passes, and the library's paths in its `on.push.paths` where it carries a `push` trigger. **Only a repo that owns its release task can make the release-task half of that edit.** The hub-hosted release task declares a closed input set, and a call passing an input it does not declare fails. So a repo calling it sets `enable_release_asset` instead and carries the leaf as its `build-release-asset` hook. The hook writes the zip, and the task uploads it under `release-asset--build-release-asset`, skipping the upload on a smoke run. Keep `expect_release_assets: true` (it has a file target, unlike Docker). The caller's own validation job is replaced by a type-appropriate validator only where the reusable one cannot express this repo's validation. The aggregator is then re-pointed to the replacement (D1.2). `smoke-build` keeps `needs: [changes]`, as D1.2 has it. `version.json` and the NBGV `get-version` **job** are retained (they own the tag). Test: S1 smoke runs validate+zip and uploads nothing. S7 attaches the zip, prerelease on the non-default leg. S9 on a push re-run skips release-create and the asset-delete (the existing zip is untouched, no registry push). A `workflow_dispatch` re-run, by contrast, is D4.4's refresh case rather than S9's, re-uploading then re-deleting the asset. - **`upstream-wrapper`.** The repo tracks an upstream project's releases rather than versioning its own code. A scheduled resolver writes a `name -> version` state file and opens a per-branch bump pull request. The merge-bot auto-merges it, or leaves it for the maintainer where the tracker sets `auto-merge: false` (D8.3). The build leaf MUST read that state file for its build or image version instead of `SemVer2`, while NBGV still tags the release (D3.5). That is because the tracker ships without this consumer wiring. Test: S11 traces the bump from resolver to the publish that ships it, which for a merge-bot-merged `main` pin is D8.3's gated publish. Nothing in this row depends on which build-target types the wrapper also declares. diff --git a/docs/reusable-workflows.md b/docs/reusable-workflows.md index 4ba98b522..e0b2848f3 100644 --- a/docs/reusable-workflows.md +++ b/docs/reusable-workflows.md @@ -56,7 +56,7 @@ A workflow whose job graph is identical across repos of a type is reached, not c ### The Hook Contract -A hook receives the fixed inputs [WORKFLOW.md "Reusable-Task Parameter Contract"][workflow-reusable-task-parameter-contract] gives a leaf today. Those are `ref`, `branch`, `smoke` where relevant, and the NBGV version outputs where a build needs them. It reports back through step outputs and, for a release target, through the existing artifact seam, `release-asset--`, which the hub's `github-release` job collects by pattern. Each task finds a hook by its `action.yml` alone, so a hook named `action.yaml` is never run. The `install-test-deps` hook is an exception, taking `leg` and `directories` inputs and reporting nothing back. It may also run a check that needs that leg's environment. A failure there fails the leg's `unit-test` job before its Python tests run. The `pre-test` hook is another, taking no inputs and reporting nothing back. Each `unit-test` leg runs it before the .NET SDK setup, where a .NET test project exists and the caller carries the hook. So a system tool a .NET test shells out to is installed before those tests run. The `build-release-asset` hook is another, writing its files into the `output-directory` it receives, on a smoke run too, and leaving the upload to the task. The task accepts only regular files at that directory's top level and refuses a subdirectory, a symlink, or a dot-prefixed name. A package hook also uploads the artifact its publish job consumes: a NuGet hook uploads `nuget-build-` as well as its `release-asset-*`. A PyPI hook uploads `pypi-build-`, and a `release-asset--pypi` too where the caller keeps `expect_release_assets` true. A NuGet or PyPI hook has to carry that exact package-artifact name or its publish job finds nothing. The `package-consume` hook is another, optional and taking `frameworks`, `package-id`, `version`, and `feed-dir` inputs while reporting nothing back. `build-nuget` runs it once after the hub default's own package consume check, in smoke and publish runs alike. So the hook loops over the JSON `frameworks` array itself. A caller carrying its own `build-nuget` hook gets neither check, since that hook's output location is unknown to the hub. The `validate` and `resolve-upstream` hooks can also take one string from their caller. `validate-task.yml` and `check-upstream-version-task.yml` each declare an optional `hook-input` input. Each passes a non-empty value on to its hook's own `hook-input` input. The task passes it from a step of its own, run only when the caller sets it. So a caller passing none runs a hook declaring no such input exactly as before. A caller that sets it needs a hook declaring `hook-input` as an optional input. The caller defines what the value means. It can name which of two callers runs the hook, or carry a change-gate result an expensive check skips on. The hub's no-op `validate-default` never receives it. A hook may use marketplace actions, which is the reason a hook is a composite action rather than a script. A toolchain setup, a Docker build, or a coverage upload is a `uses:` step, and a shell script cannot carry one. Action pins inside a hook follow the SHA-pinning rule like any other workflow content, and Dependabot bumps them in the repo that carries the hook. A hook runs with no persisted git credential, since every checkout ahead of a hook sets `persist-credentials: false`. A hook that runs git against the remote therefore passes its own credential to that call. +A hook receives the fixed inputs [WORKFLOW.md "Reusable-Task Parameter Contract"][workflow-reusable-task-parameter-contract] gives a leaf today. Those are `ref`, `branch`, `smoke` where relevant, and the NBGV version outputs where a build needs them. It reports back through step outputs and, for a release target, through the existing artifact seam, `release-asset--`, which the hub's `github-release` job collects by pattern. Each task finds a hook by its `action.yml` alone, so a hook named `action.yaml` is never run. The `install-test-deps` hook is an exception, taking `leg` and `directories` inputs and reporting nothing back. It may also run a check that needs that leg's environment. A failure there fails the leg's `unit-test` job before its Python tests run. The `pre-test` hook is another, taking no inputs and reporting nothing back. Each `unit-test` leg runs it before the .NET SDK setup, where a .NET test project exists and the caller carries the hook. So a system tool a .NET test shells out to is installed before those tests run. The `build-release-asset` hook is another, writing its files into the `output-directory` it receives, on a smoke run too, and leaving the upload to the task. The task accepts only regular files at that directory's top level and refuses a subdirectory, a symlink, or a dot-prefixed name. A package hook also uploads the artifact its publish job consumes: a NuGet hook uploads `nuget-build-` as well as its `release-asset-*`. A PyPI hook uploads `pypi-build-`, and a PyPI-only caller whose hook uploads no `release-asset-*` sets `expect_release_assets` false. A NuGet or PyPI hook has to carry that exact package-artifact name or its publish job finds nothing. The `package-consume` hook is another, optional and taking `frameworks`, `package-id`, `version`, and `feed-dir` inputs while reporting nothing back. `build-nuget` runs it once after the hub default's own package consume check, in smoke and publish runs alike. So the hook loops over the JSON `frameworks` array itself. A caller carrying its own `build-nuget` hook gets neither check, since that hook's output location is unknown to the hub. The `validate` and `resolve-upstream` hooks can also take one string from their caller. `validate-task.yml` and `check-upstream-version-task.yml` each declare an optional `hook-input` input. Each passes a non-empty value on to its hook's own `hook-input` input. The task passes it from a step of its own, run only when the caller sets it. So a caller passing none runs a hook declaring no such input exactly as before. A caller that sets it needs a hook declaring `hook-input` as an optional input. The caller defines what the value means. It can name which of two callers runs the hook, or carry a change-gate result an expensive check skips on. The hub's no-op `validate-default` never receives it. A hook may use marketplace actions, which is the reason a hook is a composite action rather than a script. A toolchain setup, a Docker build, or a coverage upload is a `uses:` step, and a shell script cannot carry one. Action pins inside a hook follow the SHA-pinning rule like any other workflow content, and Dependabot bumps them in the repo that carries the hook. A hook runs with no persisted git credential, since every checkout ahead of a hook sets `persist-credentials: false`. A hook that runs git against the remote therefore passes its own credential to that call. ### Pinning From 0cae985c874f8200e0ad5723fc22ea5a65984ffd Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Thu, 3 Dec 2026 07:10:36 -0800 Subject: [PATCH 7/7] Name Both .NET Hooks in the Release Asset Reference Part of #4609 Co-Authored-By: Claude Sonnet 5.5 --- .../references/release-publish-mechanics.md | 6 +++--- .../.source-digests/branching-and-release-model | 2 +- .../references/release-publish-mechanics.md | 6 +++--- .../references/release-publish-mechanics.md | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md index 8013eca43..0d3fce9f7 100644 --- a/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.agents/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,10 +47,10 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - The .NET `dotnet publish` or `dotnet build` lives in the dotnet-publish hook, though a package push does not. + The .NET `dotnet publish` lives in the dotnet-publish hook and `dotnet build` in the build-nuget hook, though a package push lives in neither. The hub default takes an explicit project path. - A project needing different build behavior replaces the hook. A data-only - repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook + A project needing different build behavior replaces the hook. + A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides `.github/actions/build-release-asset/action.yml` and the task fails without it. - **Package-registry pushes** (NuGet.org, PyPI): each is split, and the push never sits in the diff --git a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model index 55fd90630..c502fa2ac 100644 --- a/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model +++ b/.claude-plugin/fleet-skills/.source-digests/branching-and-release-model @@ -1 +1 @@ -a58b8142b59ef18e +c1cda920d95449ef diff --git a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md index 8013eca43..0d3fce9f7 100644 --- a/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.claude-plugin/fleet-skills/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,10 +47,10 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - The .NET `dotnet publish` or `dotnet build` lives in the dotnet-publish hook, though a package push does not. + The .NET `dotnet publish` lives in the dotnet-publish hook and `dotnet build` in the build-nuget hook, though a package push lives in neither. The hub default takes an explicit project path. - A project needing different build behavior replaces the hook. A data-only - repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook + A project needing different build behavior replaces the hook. + A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides `.github/actions/build-release-asset/action.yml` and the task fails without it. - **Package-registry pushes** (NuGet.org, PyPI): each is split, and the push never sits in the diff --git a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md index 8013eca43..0d3fce9f7 100644 --- a/.github/skills/branching-and-release-model/references/release-publish-mechanics.md +++ b/.github/skills/branching-and-release-model/references/release-publish-mechanics.md @@ -47,10 +47,10 @@ Pick by where each artifact *goes*, not by language: - **Files attached to the GitHub Release** (zips, binaries, packaged libraries): a dotnet-publish hook or a build-nuget hook per output, each uploading `release-asset--`. The default PyPI leaf uploads one too. - The .NET `dotnet publish` or `dotnet build` lives in the dotnet-publish hook, though a package push does not. + The .NET `dotnet publish` lives in the dotnet-publish hook and `dotnet build` in the build-nuget hook, though a package push lives in neither. The hub default takes an explicit project path. - A project needing different build behavior replaces the hook. A data-only - repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook + A project needing different build behavior replaces the hook. + A data-only repo's own output (e.g. a symbol library) is a file target, which the `build-release-asset` hook builds when the caller sets `enable_release_asset: true`. The hook has no hub default, so the caller provides `.github/actions/build-release-asset/action.yml` and the task fails without it. - **Package-registry pushes** (NuGet.org, PyPI): each is split, and the push never sits in the