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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ 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-<branch>-<target>`. 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
hook or a build-nuget hook per output, each uploading `release-asset-<branch>-<target>`.
The default PyPI leaf uploads one too.
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
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
Expand All @@ -61,11 +63,12 @@ Pick by where each artifact *goes*, not by language:
build-nuget hook uploads a `nuget-build-<branch>` 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-<branch>` artifact. 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-*`.
*also* uploads a `release-asset-*` (.7z) for the GitHub release.
PyPI is the same shape.
The hub default leaf uploads the `pypi-build-<branch>` artifact and a `release-asset-<branch>-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
branch `amd64`-only, and contributes **no** `release-asset-*`. The image set comes from a docker-prepare hook (the hub default emits the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -102,10 +103,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-<branch>-<name>`. 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-<branch>` / `pypi-build-<branch>`). A separate `publish-<target>` 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 <owner>/<repo>/.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-<branch>` / `pypi-build-<branch>`). A separate `publish-<target>` 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 <owner>/<repo>/.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-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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-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.*
Expand All @@ -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-<branch>-<target>`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `<target>` 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-<branch>-<target>`. A file target the hub-hosted task builds through the `build-release-asset` hook fills `<target>` 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_<target>` 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-<target>` job. A repo owning its release task also updates the target's build job there, `build-<target>` 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.*
Expand Down
Loading
Loading