Give delivery facade ownership of builds

This commit is contained in:
2026-10-06 18:23:55 +00:00
parent c9afc8dd12
commit a67a00a733
9 changed files with 605 additions and 38 deletions

View File

@@ -62,13 +62,20 @@ The command does not run candidate checks or publish tags.
## Go API
Pass the Gitea credential explicitly. A `BuildResult` may be supplied for a
binary-producing release; it must identify the same tagged repository commit
and selected version, its `SourceVerified` field must confirm the completed
build's clean, unchanged source observations, and its local artifacts must still
match their digests. Cleaning the checkout after a dirty build does not make
that build eligible for delivery.
Leave `Build` nil for a source-only release.
Pass the Gitea credential explicitly. Set `Build` to a `BuildSpec` to compile
selected targets as part of delivery. The facade verifies the local tag, clean
checkout, and committed release note before compiling. Managed output is stored
outside the checkout and removed when delivery returns. `Output` receives build
progress. With no build, or with an empty target set, delivery is page-only.
To deliver binaries built separately, set `Prebuilt` to the `BuildResult`.
ReleaseKit checks that it identifies the selected repository, tagged commit, and
version, that its source was verified clean and unchanged during compilation,
and that the current files still match their recorded digests. The files remain
caller-owned, so callers can retain the original bytes for retries and are
responsible for cleanup. With neither artifact source, an empty managed target
set, or an empty prebuilt result, delivery is page-only. Do not set both `Build`
and `Prebuilt` in one request.
```go
result, err := releasekit.Deliver(ctx, releasekit.DeliveryRequest{
@@ -81,6 +88,11 @@ result, err := releasekit.Deliver(ctx, releasekit.DeliveryRequest{
Repository: "example",
Token: token,
},
Build: &releasekit.BuildSpec{
MainPackage: "./cmd/example",
BinaryName: "example",
Targets: []releasekit.Target{{OS: "linux", Arch: "amd64"}},
},
})
if err != nil {
// Keep the returned state and any completed asset identities for recovery.