Skip to content

[SPIKE] Turnkey publish lanes: 2026 best practice per channel, so no repo reinvents its release publishing #1769

Open
7 of 9 issues completed

Description

@gerchowl

Motivation / why

Today every repo that ships anything other than a git tag + GitHub Release reinvents its publish lane. scitadel hand-wrote five workflows (scitadel#208), tessera would rediscover the same shape (tessera#441), and nothing exists at all for npm. #1746 (merged on dev via #1750) established the seams — draft-Release-first owner, pre-publish assets window, standalone publish-release-extension.yml on release: published — but every seam is a no-op a consumer must fill by hand.

Goal: a repo declares which channels it publishes to, and devkit scaffolds and keeps upgrading a lane that meets the 2026 industry bar for that channel (keyless/OIDC auth, provenance attestations, immutability, idempotent retries, prerelease handling). Adopting a channel should be "declare + one-time registry registration", not "copy a recipe and maintain it forever".

This issue is the spike umbrella: one sub-issue per channel researches the current best practice and answers what devkit should own vs. leave to the repo. The spikes produce decisions, not code; implementation issues follow per channel.

Decision / proposed approach (best guess — reviewers should refute)

  1. Declaration, evidence-seeded. A .vig-os key (strawman: DEVKIT_PUBLISH=crates,pypi,npm,oci,nix,binaries) — same contract as DEVKIT_LANGUAGES: a declaration the scaffold seeds from evidence (Cargo.toml without publish = false, pyproject.toml with a build backend, package.json without "private": true, …), never a detection cache. Per the smallest-denominator rule (Smallest denominator, not the sum: stop shipping speculative defaults to every Rust consumer #1519), undeclared channels ship nothing.
  2. Managed, not seeded, for the publish mechanics. The per-channel publish logic (auth, idempotency precheck, attestations, prerelease routing) is devkit-managed and regenerated on upgrade, so security fixes propagate via devkit-upgrade. The build stays project-owned via justfile.project recipes (e.g. just dist-pypi, just dist-npm), matching how CI already delegates to project recipes.
  3. Two windows, as Release train: first-class Rust release extension (crates.io, cargo-dist binaries, wheels) via a general publish/Release-owner seam #1746 defined: things that belong on the GitHub Release (binaries, wheels, SBOM, checksums, attestations) go in the pre-publish assets window; irreversible outward publishes (registries, caches) go after release: published.
  4. Uniform per-channel contract: Trusted Publishing / OIDC wherever the registry supports it (no long-lived tokens), provenance attestation, idempotent "skip if the registry already has this version" precheck, workflow_dispatch retry by tag, explicit prerelease policy (publish RCs or not, and under which dist-tag / version spelling).

What already exists

Scope

P0 — one spike per channel (sub-issues)

  • GitHub Releases & release assets (checksums, SBOM, attestations, immutability)
  • crates.io
  • PyPI (incl. PyO3/maturin wheels)
  • npm
  • Prebuilt binaries & installers (cargo-dist, goreleaser-class tools, Homebrew)
  • OCI images (GHCR)
  • Nix binary caches (Cachix / FlakeHub / attic)

P1 — cross-cutting verdict

  • Declaration key shape and evidence rules
  • Managed-vs-seeded split, and where OIDC subject binding forces a fixed top-level workflow filename
  • Prerelease policy matrix (per channel: publish RCs? how spelled? which tag?)

P2

Pitfalls

  • OIDC subject binding vs. reusable workflows. crates.io and PyPI Trusted Publishing bind to the workflow file path; a devkit-managed reusable workflow may not be registrable, and renaming a managed file later silently breaks every consumer's registry registration. The filename is a forever-contract.
  • Irreversibility asymmetry. A GitHub Release is abandonable while draft; crates.io / PyPI / npm versions are burned the moment they publish. RC policy must not burn final version numbers.
  • Version spelling. One train version must map to SemVer (1.2.3-rc.1), PEP 440 (1.2.3rc1), npm dist-tags, OCI tags — interacts with DEVKIT_PRERELEASE_FORMAT (Release train: first-class Rust release extension (crates.io, cargo-dist binaries, wheels) via a general publish/Release-owner seam #1746).
  • Approval gates. GitHub environment: required reviewers add a second human approval, contradicting the "single approval = release PR" rule in docs/RELEASE_CYCLE.md.
  • Speculative defaults. Shipping all channels to every repo repeats the Smallest denominator, not the sum: stop shipping speculative defaults to every Rust consumer #1519 anti-pattern; declared-only.
  • Token triggering. Anything that publishes the Release with GITHUB_TOKEN never fires release: published (the cargo-dist trap).

Acceptance criteria

  • Every channel sub-issue closed with a dated verdict: 2026 best practice, gap vs. devkit today, and a concrete "devkit owns X / repo owns Y" split
  • Cross-cutting verdict on declaration key, managed-vs-seeded split, prerelease matrix
  • Implementation issues filed per channel (or explicit "won't do" with reason)
  • ADR drafted

References

#1746, #1748, #1754, #1523, #1519, #1496, #1144, #988 · docs/DOWNSTREAM_RELEASE.md · docs/RELEASE_CYCLE.md · docs/rfcs/ADR-capability-modules.md

Sub-issues

Sub-issues

7 of 9 Issues completed
Loading 9 sub-issues

Activity

  1. added
    discussion
    area:workspace
    area:workflow
    on Sep 29, 2026
  2. gerchowl commented on Sep 29, 2026

    @gerchowl
    ContributorAuthor

    Round-1 consolidation (8 fresh-context reviews: 7 channel specialists + 1 platform architect, 2026-09-29)

    Per-channel findings with sources are in comments on #1770–#1776.

    Where all reviewers agree

    1. Registry Trusted Publishing (crates.io, PyPI, npm) binds to the top-level caller workflow filename; reusable workflows cannot be the publisher. The managed registry lane must therefore be a top-level file in each consumer, and its filename is a forever contract. Renaming it breaks every registration at every registry, and devkit-upgrade cannot re-register.
    2. Publish mechanics are managed; builds are repo-owned (just dist-*). All seven channel reviewers reached this split independently. It also means [FEATURE] Rust pack L6: seed templates for the three release seams (cargo set-version, publish dry-run, cargo publish --workspace + Trusted Publishing) #1748 should change from seeded to managed.
    3. No long-lived registry tokens anywhere Trusted Publishing exists. npm revoked classic tokens on 2025-12-09. Homebrew taps (no OIDC) use an App installation token, and Cachix (no OIDC) keeps a per-repo token.
    4. Checksums and provenance are a generic devkit step over all Release assets, not per-tool. Assets arrive from several workflows, so this step needs an explicit fan-in before promote.
    5. Every publish is idempotent (skip versions the registry already has) and can be retried with workflow_dispatch by tag.

    Where they disagree, and the proposed resolution

    Question Positions Proposal
    One file or one per channel Architect: a single publish-release.yml with a job per channel. npm/PyPI reviewers: publish-npm.yml, publish-pypi.yml, … One managed publish-release.yml. It is one forever-contract name instead of N. Each channel job is gated on DEVKIT_PUBLISH, and each job body is a devkit-owned composite action, which keeps the caller's OIDC identity while still centralising fixes. workflow_dispatch takes tag plus an optional channel input.
    OCI mechanism OCI reviewer: a devkit reusable workflow is fine Agree, as an exception. No registry Trusted Publishing is involved, and the cosign/Fulcio identity then binds to devkit's reusable path, giving one stable identity for admission policies. That path is also frozen.
    Nix Nix reviewer: this is CI infrastructure, not a publish channel Agree. Move the cache push into the pre-publish window (as upstream does), keep it out of DEVKIT_PUBLISH, and skip FlakeHub.
    environment: gates Would add a second approval, conflicting with the single-approval rule An environment with no reviewers, restricted by deployment rule to tag refs. That gives the registries an OIDC environment claim to bind against without adding a human. UNVERIFIED: whether the scaffold can assert it via API; needs a probe.
    Where the checksum/attestation seal runs GH reviewer: before promote, never at tag time As the first job of promote-release.yml. Promote is already the natural fan-in: a human dispatches it once all assets are on the draft. Asset producers attest their own build provenance; promote writes and attests SHA256SUMS and refuses to undraft if any asset lacks an attestation.

    Prerelease matrix (divergent by design)

    Channel Release candidates
    GitHub Release draft pre-release when create-release: true (unchanged)
    crates.io off by default (permanent, never resolved by ^); opt-in, dotted rc.N
    PyPI on, as production prereleases (1.2.3rc1); not TestPyPI
    npm on, --tag next; never latest
    OCI on, X.Y.Z-rcN tags, pruned on promote; floating tags only after publish

    Pitfalls added to the original list

    • The first publish is manual on crates.io and npm. PyPI has pending publishers; the others have no equivalent. Adoption therefore has a one-time human bootstrap per package, and the runbook must say so.
    • DEVKIT_PRERELEASE_FORMAT values can be unmappable to PEP 440 (nightly.YYYYMMDD.N, bare beta). The PyPI lane must refuse or normalise them before publish.
    • crates.io allows 5 new crates, then 1 per 10 min, so greenfield workspaces need a staged first publish.
    • actions/attest* v4+ also needs artifact-metadata: write; release-candidate pruning on GHCR needs packages: admin.
    • The wheel or crate uploaded to the Release must be the same bytes as the one published to the registry.
    • Adoption over a hand-written publish-release-extension.yml: scaffold the managed file alongside it, fail a preflight if both publish the same channel, and never rewrite the repo-owned file.

    Proposed implementation order

    1. Release seal ([SPIKE] Publish lane: GitHub Releases & release assets (checksums, SBOM, attestations, immutability) #1770): checksums, attestation gate in promote, ruleset/immutable preflight. Every other channel relies on it.
    2. publish-release.yml skeleton, DEVKIT_PUBLISH declaration + evidence rules, and composite-action layout; freeze the filename in an ADR.
    3. PyPI ([SPIKE] Publish lane: PyPI (Trusted Publishing, PEP 740 attestations, pure + PyO3/maturin wheels) #1772) and crates.io ([SPIKE] Publish lane: crates.io (Trusted Publishing, atomic workspace publish, semver gates) #1771, absorbs [FEATURE] Rust pack L6: seed templates for the three release seams (cargo set-version, publish dry-run, cargo publish --workspace + Trusted Publishing) #1748). tessera and scitadel are concrete adopters.
    4. OCI ([SPIKE] Publish lane: OCI images / GHCR (cosign, SBOM, provenance, floating tags) #1775): extract upstream's lane into the reusable workflow.
    5. npm ([SPIKE] Publish lane: npm (Trusted Publishing, provenance, dist-tags) #1773) and a separate GitHub Action / Marketplace seed.
    6. Binaries ([SPIKE] Publish lane: prebuilt binaries & installers (cargo-dist, Homebrew, signing) #1774): managed wrapper now; shrinks once cargo-dist#2521 lands.
    7. Nix ([SPIKE] Publish lane: Nix binary caches & flake distribution (Cachix, FlakeHub, attic) #1776): CI cache seed plus release-cache push (not a DEVKIT_PUBLISH channel).

    Biggest risk (architect): the managed filename becomes an org-wide single point of failure. Mitigations: freeze it in an ADR; add a publish-preflight that fails closed when the registered subject drifts; allow no breaking change to that file.

  3. gerchowl commented on Sep 29, 2026

    @gerchowl
    ContributorAuthor

    Status:

    The channel spikes (#1770–#1776) close when the ADR is accepted.

  4. c-vigo commented on Sep 30, 2026

    @c-vigo
    Contributor

    ADR merged in #1785 (36e74cc); channel spikes #1770–#1776 are closed with pointers to their implementation issues (#1777–#1787). The ADR's front matter still reads status: proposed; the flip to accepted rides the next devkit fix PR.

    Still open on this spike: dated rows in the #1523 stack matrix for every channel verdict. This issue stays open until they land.

  5. c-vigo commented on Sep 30, 2026

    @c-vigo
    Contributor

    ADR status flipped to accepted on dev in #1792.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:workflowarea:workspacediscussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions