Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
sacOO7
force-pushed
the
ci/release-workflow-prechecks
branch
from
November 4, 2026 19:06
6ae859c to
5214bb9
Compare
sacOO7
force-pushed
the
ci/release-workflow-publish
branch
from
November 4, 2026 19:06
a333da7 to
091ac91
Compare
Add the publish job to release.yml. It runs only on a real run on main, in the nuget environment, with id-token: write as its only permission. It checks out and runs no repository code. NuGet/login exchanges the OIDC token for a short-lived key. The job pushes Ably.PubSub.Core and waits until nuget.org serves it, then logs in again and pushes Ably.PubSub.Device and Ably.PubSub.Server. Every push uses --skip-duplicate, so failed jobs can be re-run. Add the github-release job. It creates an annotated, dated tag on the released commit, and a GitHub release with the .unitypackage attached. The notes come from the release-notes artifact that the plan job extracts from CHANGELOG.md, so this job, which holds a write token, runs no repository code either. Both steps are idempotent when re-run. Rewrite the release process in CONTRIBUTING.md around the workflow: preparing the release PR (with a local Release.Preflight run), publishing, approving, after the release, what to do if something goes wrong, the manual fallback and withdrawing a version. Update the packaging paragraph in cake-build/README.md, and remove the "nothing was published" warning that the previous change added.
sacOO7
force-pushed
the
ci/release-workflow-prechecks
branch
from
November 4, 2026 19:37
5214bb9 to
6574318
Compare
sacOO7
force-pushed
the
ci/release-workflow-publish
branch
from
November 4, 2026 19:37
091ac91 to
f2ed32b
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the two jobs that let
release.ymlactually release:publishpushesAbly.PubSub.Core, waits until nuget.org serves it, then pushesAbly.PubSub.DeviceandAbly.PubSub.Server. It uses nuget.org Trusted Publishing, so no API key is stored anywhere, and it runs only after a reviewer of thenugetenvironment approves.github-releasecreates an annotated tag and the GitHub release, with the CHANGELOG notes and the.unitypackageattached.It also changes the release process in
CONTRIBUTING.mdto use the workflow, and keeps the manual process as a fallback.It's stacked on #1385. See "Stacked on PR 1" at the end.
Before merging
Do these in the repo settings first. If a job names an environment that doesn't exist, GitHub creates it on first use with no protection rules. The
nugetenvironment doesn't exist yet (checked on 2026-11-04).While
NUGET_USERis missing, the login would fail before any push. Don't rely on that: once the secret is added before the protection rules, a real run could publish without any review.nuget(Settings → Environments).mainonly and no tag patterns.NUGET_USER: the nuget.org username of the person who created the "Ably PubSub" Trusted Publishing policy.ably-realtime, and it isn't an email address. nuget.org looks the policy up by its creator, and the policy page shows only the owner.ably-realtimeorg, or the policy goes inactive.gh api repos/ably/ably-pubsub-dotnet/environments/nugetshows arequired_reviewersrule andcustom_branch_policies: true;gh api repos/ably/ably-pubsub-dotnet/environments/nuget/deployment-branch-policieslists onlymain;gh secret list --env nuget -R ably/ably-pubsub-dotnetshowsNUGET_USER.What's in it
publishIt runs only on a real run on
main, after the approval. It holds the only OIDC-capable token, so it checks out and runs no repository code: no checkout, no Cake.output-packageartifact that the same run packed and summarised. The pushed files are therefore exactly the ones the summary lists with SHA-256 values.NuGet/login(v1.2.0, pinned by SHA) exchanges the job's GitHub OIDC token for a short-lived nuget.org API key.id-token: write.usercomes from theNUGET_USERenvironment secret, which GitHub releases only after the approval.Ably.PubSub.Corewith--skip-duplicate.[x.y.z]), so they mustn't go out before Core resolves.--skip-duplicate.github-releaseThis job holds a write token, so it doesn't check out or run repository code either. It works only from the run's artifacts and the
ghCLI.<version>onGITHUB_SHA, tagged bygithub-actions[bot]and dated at release time. The 2.0.0 tag is lightweight, so it carries the merge commit's date instead.git ls-remoteagainst the repository URL, so it needs no checkout.release-notesartifact that PR 1'splanjob extracts withRelease.Notes(cake-build/release.cake). They are the CHANGELOG section for the version, without its heading and its "Full Changelog" line, the same shape as the 2.0.0 release body. A dry run shows the same notes in its summary.gh release create --verify-tag, withably.pubsub.<version>.unitypackageattached. A version with a-suffix is marked as a prerelease and isn't marked "Latest".--clobber), and a leftover draft is published. That keeps re-runs working if immutable releases are turned on later.Both jobs carry
if: ${{ !inputs.dry_run && github.ref == 'refs/heads/main' }}. That adds to the main-only step inprechecksand to the environment's branch rule. Dry runs never reach either job.Docs and the workflow header
CONTRIBUTING.md, "Release process" is rewritten around the workflow, in these sections:Release.Preflightrun before the PR is opened. The READMEPackageReferencestep is gone: the README hasn't pinned a version since Simplify the README for the 2.0 device and server packages #1384. The CHANGELOG step gives the heading format the workflow checks.package.ymlplus a short-lived API key scoped toAbly.PubSub.*. The release notes come from the run'srelease-notesartifact or fromRelease.Notes.Nothing from the old release steps is lost: each one is kept, or replaced by the workflow and kept in the manual fallback.
cake-build/README.md: the packaging paragraph no longer says that nothing is published. It now says thatrelease.ymlcallspackage.ymland publishes, and that a hand push is the fallback.release.yml: the header points to "If something goes wrong" inCONTRIBUTING.md, and PR 1's "nothing was published" warning step is removed. Comments are brief, and only where the reason isn't obvious.Recovery
If a run fails after the approval, use "Re-run failed jobs" on the same run. Every push uses
--skip-duplicate, and the tag and release steps are idempotent, so whatever already succeeded is skipped. The pre-checks refuse a new dispatch for a version that is partly published. The table under "If something goes wrong" inCONTRIBUTING.mdcovers each failure point. That includes a Core push that fails nuget.org validation: the version number is then used up, so release the next patch.Decisions taken, and open questions
Taken, using the plan's defaults:
.unitypackage, as for 2.0.0.Still open. Only the Phase 0 settings above block the merge:
NUGET_USER.nugetenvironment's reviewers?2.0.1-rc.1, or a fork that publishes to int.nugettest.org.Testing done
Lint: actionlint 1.7.12, with shellcheck 0.11.0, reports nothing for
release.yml. Both workflow files parse, and all 14run:blocks passbash -n. The shell in the final file is 98 lines (93 in multi-line blocks, plus five one-line commands); it was 180 before the checks moved to Cake. Most of what remains is the push, wait andghsteps, which stay in YAML on purpose.Release notes:
Release.Notes, tested in PR 1, reproduces the published 2.0.0 release body exactly, apart from the CRLF line endings GitHub stored.Wait loops, with a mocked
curl:Tag step, run from an empty directory to prove it needs no checkout:
^{}line;git/tagsand thengit/refswith the expected arguments (mockedgh).Release step, with a mocked
gh, reading the notes fromrelease-notes/release-notes.md:Not testable before a real release:
A login problem fails before anything is pushed. The first real release, such as 2.0.1, is the end-to-end test. PR 1's dry runs already cover the pre-checks and packing.
To confirm before or at the first release:
planjob and check that it downloadsoutput-packagefrom the earlier attempt. "Re-run failed jobs" recovery relies on that;output-package. The setting couldn't be read through the API (403);nugetapproval again isn't documented. Plan for a reviewer being needed.No .NET build, because no product or test code changed, and this PR doesn't change any Cake script.
Stacked on PR 1
This PR targets
ci/release-workflow-prechecks(#1385), so its diff shows only these changes. Merge PR 1 first, then retarget this PR tomain.Part of #1377. That issue stays open until the first real release.