Skip to content

ci: publish a CI run's packages from a separate workflow - #212

Merged
carldebilly merged 1 commit into
mainfrom
dev/cdb/publish-dev-on-demand
Nov 14, 2026
Merged

carldebilly merged 1 commit into
mainfrom
dev/cdb/publish-dev-on-demand

Conversation

@carldebilly

@carldebilly carldebilly commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Every push to main published a v0.13.0-dev.N tag, a GitHub prerelease and twelve packages to NuGet. Nobody consumes those. Publishing moves to a separate workflow that publishes the packages a CI run already built and tested, without rebuilding.

Behaviour

CI run Published?
Pull request never
Push to main only by hand: gh workflow run publish.yml -f run-id=<id> (id = number in the CI run's URL)
Push to release/**, success automatically (workflow_run)
Push to release/**, failed after a successful re-run

Every job of the CI run must succeed, not only Build, Test, Pack as before.

Changes

  • ci.yml builds, tests and packs, and publishes nothing. The artifact is packages-<version> (30 days). The token is contents: read; checks: write is granted only to build-test-pack (test report).
  • publish.yml (new):
    • checks the source run through the API: this repository's ci.yml, a push, a success, on main or release/*;
    • downloads its artifact and checks every .nupkg carries the version from the artifact's name;
    • runs the release and NuGet steps moved from ci.yml, with the tag on the run's commit.
    • Publications queue one at a time (queue: max), so an unrelated CI completion cannot cancel a pending one. GITHUB_TOKEN is given only to the steps that call gh.
  • Docs: docs/publishing.md and docs/architecture.md.

Before merging (repository and NuGet settings)

  1. NuGet Trusted Publishing: add a policy with workflow file publish.yml (owner yllibed, repo repl, environment nuget). Without it the first publication fails at Authenticate to NuGet. Remove the ci.yml policy once publish.yml has published.
  2. nuget environment: limit the deployment branches to main only (remove release/*). Both paths of publish.yml run with GITHUB_REF=main. A release/* rule would let a modified publish.yml dispatched from a release branch obtain a NuGet key without any of its checks.

Verification

  • YAML parses, bash -n passes on every step, markdownlint passes. actionlint could not be run here.
  • The run-resolution step, run locally against real runs, rejects:
    • a non-numeric id;
    • a pull-request run;
    • a cancelled run;
    • an older run whose artifact is still named packages.
  • The version check passes on matching packages and fails on a mismatched or empty folder.
  • The positive path (download, OIDC, release, NuGet) can only run after merge. Publishing a build of main by hand is the first validation, without cutting a release.
  • Reviewed by skeptic, security, quality and ai-slop; their findings are applied.

@carldebilly carldebilly added this to the 0.13.0 milestone Nov 13, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T02:14:26.336680Z 2762880 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Every push to main published a v0.13.0-dev.N tag, a GitHub prerelease and
twelve packages to NuGet. Nobody consumes those. Publishing now lives in
publish.yml and works on a CI run that already built and tested the
packages; nothing is rebuilt.

- ci.yml builds, tests and packs, and publishes nothing. The packages
  artifact is named packages-<version> and kept 30 days. The workflow
  token is contents: read; checks: write moves to build-test-pack, the
  only job that writes a check run.
- publish.yml runs on its own when CI succeeds on a push to release/**
  (workflow_run, filtered on release/**), and by hand for any other
  successful CI push run of main or release/**:
  gh workflow run publish.yml -f run-id=<id>. It checks the run (ci.yml
  of this repository, push, success, main or release/*), downloads its
  packages-<version> artifact, checks every package carries that version,
  then runs the release and NuGet steps moved from ci.yml, tagging the
  run's commit.
- Publications run one at a time and queue (job-level concurrency,
  queue: max), so an unrelated CI completion cannot cancel a pending one.
- GITHUB_TOKEN is given only to the steps that call gh.
- The nuget environment must admit main only: workflow_run always runs
  main's copy, and a dispatch from another branch is then refused
  instead of letting that branch's copy obtain a NuGet key.

docs/publishing.md and docs/architecture.md describe the new split, the
environment rule and the Trusted Publishing policy, which now names
publish.yml.
@carldebilly
carldebilly force-pushed the dev/cdb/publish-dev-on-demand branch from 861deec to 2762880 Compare November 13, 2026 02:13
@carldebilly carldebilly changed the title ci: publish -dev prereleases from main on demand only ci: publish a CI run's packages from a separate workflow Nov 13, 2026
@carldebilly
carldebilly merged commit 5f08f8c into main Nov 14, 2026
15 checks passed
@carldebilly
carldebilly deleted the dev/cdb/publish-dev-on-demand branch November 14, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant