Skip to content

ci(release): push the release commit over SSH with a deploy key - #326

Merged
KaiSchwarz-cnic merged 1 commit into
masterfrom
RSRMID-2994/release-push-deploy-key
Aug 26, 2026
Merged

ci(release): push the release commit over SSH with a deploy key#326
KaiSchwarz-cnic merged 1 commit into
masterfrom
RSRMID-2994/release-push-deploy-key

Conversation

@KaiSchwarz-cnic

@KaiSchwarz-cnic KaiSchwarz-cnic commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Part of RSRMID-2994 — this repository is the pilot.

What

  • .releaserc.json: pins repositoryUrl to git@github.com:centralnicgroup-opensource/rtldev-middleware-php-sdk.git.
  • docs/agents/ci-release.md: documents the new release-push auth and the two traps in it.

Why repositoryUrl is not optional

semantic-release's lib/get-git-auth-url.js expands shortcut URLs to HTTPS before it ever tries SSH:

if (info && info.getDefaultRepresentation() === "shortcut") {
    repositoryUrl = info.https();      // github:owner/repo  ->  https://...
}
await verifyAuth(repositoryUrl, branch.name, ...);

package.json carries "repository": "github:centralnicgroup-opensource/rtldev-middleware-php-sdk.git" — a shortcut. Without this override SSH is never attempted at all, and the deploy key on the runner goes unused.

What this buys

The @semantic-release/git push moves off RTLDEV_MW_CI_TOKEN — a personal account's PAT with admin over every repository in the organisation — and onto a deploy key scoped to this repository alone. That is what makes the default-branch-protection ruleset switchable on here: DeployKey is its only bypass actor, so the release push gets past it and nothing else does. Until now this repository carried releases-to-branch in the workspace register, meaning branch protection was withheld entirely for want of a bypass.

Unchanged on purpose

  • GITHUB_TOKEN stays in the release step: @semantic-release/github creates the GitHub release with it, and .github/scripts/publish-docs.sh force-pushes gh-pages with it.
  • The gh-pages push is not moved to the deploy key. The ruleset targets ~DEFAULT_BRANCH, so that push is not subject to it, and moving it would widen what the key is used for without removing a restriction.

Order

Merge after centralnicgroup-opensource/rtldev-middleware-shareable-workflows#104, which puts the key on the runner. Merging this first would point the push at SSH with no key present, and the release would fall back to HTTPS.

Then the workspace register PR, then scripts/org-settings.sh --apply php-sdk to create the ruleset, then a real release verified with DEBUG: semantic-release:get-git-auth-url.

🤖 Generated with Claude Code

The release push went out as RTLDEV_MW_CI_TOKEN, a personal account's PAT with
admin over every repository in the organisation. It worked against classic
branch protection only because enforce_admins is false and the token's owner is
an admin — an implicit bypass that rulesets do not have, which is why this
repository has had RULESET_ENABLED=false and weaker protection than before the
settings were centralised.

The push now uses a deploy key scoped to this repository (RTLDEV_MW_CI_SSH_KEY),
which the default-branch-protection ruleset names as its only bypass actor. A
leaked key costs one repository instead of all of them, and the personal account
stops being the push identity.

repositoryUrl is not optional. lib/get-git-auth-url.js expands shortcut URLs to
HTTPS before SSH is attempted, and package.json's "repository" is a shortcut
("github:centralnicgroup-opensource/rtldev-middleware-php-sdk.git"), so without
the explicit git@github.com form SSH is never tried at all.

GITHUB_TOKEN stays: @semantic-release/github creates the GitHub release with it
and publish-docs.sh force-pushes gh-pages with it. Only the git push moved. The
gh-pages push needs no change — the ruleset targets ~DEFAULT_BRANCH.

Requires centralnicgroup-opensource/rtldev-middleware-shareable-workflows to
provide the SSH key first; that change lands before this one.
@KaiSchwarz-cnic
KaiSchwarz-cnic force-pushed the RSRMID-2994/release-push-deploy-key branch from e91a894 to cf7be3a Compare August 26, 2026 13:32
@KaiSchwarz-cnic
KaiSchwarz-cnic merged commit 51a0475 into master Aug 26, 2026
14 checks passed
@KaiSchwarz-cnic
KaiSchwarz-cnic deleted the RSRMID-2994/release-push-deploy-key branch August 26, 2026 13:55
@KaiSchwarz-cnic

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 33.0.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant