Repository navigation
Publish and release to Maven Central (h3-java pattern) - #94
Conversation
Match h3-java: upload, validate, and promote in CI instead of staging-only publishToMavenCentral. Wait for PUBLISHED before the workflow completes.
Add CHANGELOG-driven GitHub Releases, workflow_dispatch snapshot stripping, and VERSION_NAME/BUILD.bazel prep commits. Keep publishAndReleaseToMavenCentral.
| exit 0 | ||
| fi | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
There was a problem hiding this comment.
We shoudln't check in an email, right?
| run: ./gradlew publishToMavenCentral --no-daemon | ||
| run: ./gradlew publishAndReleaseToMavenCentral --no-daemon | ||
|
|
||
| - name: Create GitHub Release |
There was a problem hiding this comment.
h3-java includes the github token as an env var, is that needed to invoke the api and handle this?
| awk -v ver="$RELEASE_VERSION" ' | ||
| /^## / { if (found) exit; if (index($0, "## [" ver "]") == 1) { found=1; next } } | ||
| found | ||
| ' CHANGELOG.md > release_notes.md |
There was a problem hiding this comment.
Are you tracking a changelog already? If not, the generated one from PR names could also be an option, although I'm not sure what that looks like via the workflow.
Use runtime git identity, GITHUB_TOKEN for gh-release, match h3-java filename.
tyvsmith
left a comment
There was a problem hiding this comment.
Thanks for iterating on this. Motif's version of this workflow (uber/motif#281) landed and published 0.4.0-alpha16 successfully. Its structure would work well here, with a few ussi-specific differences.
Drop the manual dispatch
mainrequires "test on ubuntu-latest" and "test on macos-latest" to pass, with admins not exempt. The commit created by "Prepare release version on main" has no checks, sogit push origin HEAD:mainshould be rejected. h3-java hit the same wall, which is why its snapshot-bump step is commented out.- Dispatch only works when
VERSION_NAMEis already the release version, and then it does what a tag push already does. release_versionhas to equal the version derived fromVERSION_NAME, so it can't override anything.- softprops creates the tag on whatever
main's latest commit is when that step runs, not on the commit that was built. - Dropping dispatch also lets checkout go back to
persist-credentials: falsewithoutfetch-depth: 0.
Gaps
- Pin comments don't match the SHAs: checkout
3d3c42eis v7.0.1 (not v4.2.2), setup-javade7274fis v6.0.1 (not v4.7.0), gradle/actions9c97196is v6.3.0 (not v4.4.0), softpropsefb3536is v3.0.3 (not v2.3.3) BUILD.bazelisn't checked: the tag path compares the tag withVERSION_NAMEonly. Please also check thatmaven_coordinatesinBUILD.bazelmatches, so Bazel coordinates can't drift.- v0.1.0 cleanup: a draft GitHub Release already exists for
v0.1.0. Delete it before moving the tag, or the release step may update the draft or create a second one. Also confirm that deploymentb099eae0…was dropped on Central first. - Notes check:
[[ ! -s release_notes.md ]]passes a section with only blank lines.grep -q '[^[:space:]]' release_notes.mdcatches that. - Write access for a third-party action:
contents: writecovers every step. Motif usesgh release create "$RELEASE_TAG" --verify-tag --notes-file release_notes.mdwithGH_TOKEN: ${{ github.token }}, which avoids the third-party action entirely. - Redundant env vars:
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLEDis already set ingradle.properties- softprops'
tokeninput already defaults togithub.token
Keep as is
- the
vX.Y.Ztag format and the Keep a Changelog## [X.Y.Z]sections - the Gradle
teststep:tests.ymlonly builds with Bazel, so this is the only place the Gradle publish path gets exercised. A Gradle build job intests.ymlthat isn't a required check would catch breakage before release day; that can be a follow-up. mavenCentralDeploymentValidation=PUBLISHED
Known limitation
If the GitHub Release step fails after publishing, "Re-run failed jobs" re-runs publish too, and that fails because Central won't accept the same version twice. Motif has the same gap; it's fine to leave for now.
Review drafted with an AI agent.
Tag-triggered publishToMavenCentral with automatic Central promotion, motif-style changelog and GitHub Release, and USSI BUILD.bazel validation.
tyvsmith
left a comment
There was a problem hiding this comment.
Thanks, this matches Motif's workflow (uber/motif#281) and keeps the right ussi-specific pieces. The dispatch removal, gh release create, the notes check, and the BUILD.bazel check all look good. I checked the BUILD.bazel check and the changelog extraction against this branch, and both return 0.1.0.
A correction to my earlier review: tests.yml already runs gradle test on ubuntu-latest, so dropping the Gradle test step from the release workflow is right. My "keep the Gradle test step" point was wrong.
Before re-tagging v0.1.0:
- delete the existing draft GitHub Release for
v0.1.0. A draft doesn't reserve the tag, sogh release createwould likely create a second release next to it. - confirm deployment
b099eae0…was dropped on Central - move
v0.1.0from5ddc9e9to the merge commit and push it with--force. A forced tag push still starts the workflow.
Nit: the CHANGELOG.md header still says it's based on Keep a Changelog, but the sections now use the # X.Y.Z format. Drop or reword that line.
Review drafted with an AI agent.
Summary
Align USSI release automation with landed motif #281:
.github/workflows/release.ymlonly (vX.Y.Z)mainvia PR (VERSION_NAME,BUILD.bazel,# X.Y.ZinCHANGELOG.md)publishToMavenCentral+mavenCentralAutomaticPublishing=true(org secrets, no manual Portal promote)gh release create+ changelog sectionBUILD.bazelmaven_coordinates; JDK 21 only (single artifact)Removes workflow_dispatch, auto-commits, and
publishAndReleaseToMavenCentralfrom the prior draft.After merge
Re-tag
v0.1.0on merge commit to publishcom.uber.ussi:ussi:0.1.0with current org signing.Test plan
release.ymlv0.1.0and confirm Actions + repo1 + GitHub Release