Skip to content

ci(release): rewrite SSH URL to HTTPS so release:prepare push uses PAT#16

Merged
jcputney merged 1 commit into
mainfrom
ci/release-url-rewrite
May 20, 2026
Merged

ci(release): rewrite SSH URL to HTTPS so release:prepare push uses PAT#16
jcputney merged 1 commit into
mainfrom
ci/release-url-rewrite

Conversation

@jcputney
Copy link
Copy Markdown
Owner

Summary

Second swing at unblocking the v0.4.0 release. Previous PAT swap fixed checkout but `release:prepare` still failed:
```
git@github.com: Permission denied (publickey).
```

Root cause: `release:prepare` reads pom's `` directly and does NOT honor `-DdeveloperConnection=...` as a CLI override (only `-DconnectionUrl=...` is exposed, and only for `release:perform`). So pom's SSH URL was still in play, but the runner has no SSH key.

Fix

Add `git config --global url."https://github.com/".insteadOf "git@github.com:"` before `mvn release:prepare`. When maven-scm-provider-gitexe spawns `git push git@github.com:...`, git transparently rewrites to HTTPS, and the http.extraheader from `actions/checkout` (set up by the RELEASE_TOKEN PAT) authenticates the push. PAT owner has Admin role, which is in main-protection ruleset's bypass_actors → push succeeds.

pom.xml unchanged — local devs keep their SSH workflow.

Test plan

  • PR checks green (workflow-only change)
  • Re-trigger `Release` workflow on main after merge
  • `release:prepare` push succeeds (the previously-failing step)
  • Maven Central publish (`release:perform`)
  • SBOM + attestations + GitHub Release

The previous PAT swap unblocked checkout's HTTPS clone but not maven-
release-plugin's push. `release:prepare` reads pom's <developerConnection>
directly and does NOT expose a `developerConnection` CLI override (only
`connectionUrl`, which `release:perform` consumes for the post-tag
checkout). So `-DdeveloperConnection=...` had no effect — the push still
ran against pom's SSH URL and failed with "Permission denied (publickey)"
because there's no SSH key on the runner anymore.

Fix: git URL rewriting via `url.<base>.insteadOf`. When maven-scm-
provider-gitexe spawns `git push git@github.com:jcputney/magika-java.git`,
git transparently rewrites the URL to `https://github.com/...`, and the
http.extraheader set up by actions/checkout authenticates the push with
the RELEASE_TOKEN PAT.

This leaves pom.xml's developerConnection at its SSH URL — local devs
running `mvn release:prepare` continue to work the same way.
@jcputney jcputney enabled auto-merge (squash) May 20, 2026 18:01
@jcputney jcputney merged commit 986730c into main May 20, 2026
11 checks passed
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