feat: drive releases from a single GitHub Actions workflow#108
Merged
Conversation
Replaces the previous two-workflow setup (push a tag, separate publish workflow listens for it) with a single end-to-end `Release` workflow at `.github/workflows/release.yml`. The old `publish-release-from-tag.yml` is removed. Flow: 1. Actions → Release → Run workflow with `version=vX.Y.Z` and the full 40-char commit `sha` to release. 2. The job runs in the protected `release` GitHub Environment, which holds the Sonatype / GPG secrets and requires reviewer approval before anything happens. 3. After approval, the workflow validates the version and SHA, verifies the SHA is reachable from `origin/main`, runs `./gradlew check` on the pinned SHA, creates and pushes the annotated tag `vX.Y.Z` pointing at that SHA, checks out the tag, re-runs `./gradlew check`, builds artifacts, creates the GitHub Release with the SDK / agent / OTel extension jars attached, publishes to Maven Central via Sonatype, and polls Maven Central until the version is visible. The releaser must supply an explicit commit SHA (not a branch name) so that commits which land on `main` while the run is paused at the environment approval gate are NOT silently included in the release. Because publishing happens in the same workflow as the tag push, the tag push no longer needs to retrigger anything. The default `GITHUB_TOKEN` is sufficient — no GitHub App / PAT is required. Re-publish path: re-run `Release` with the same version (and any valid SHA — it's ignored once the tag exists). The workflow detects the existing tag, skips tag creation, and resumes from build/publish. GitHub Release asset uploads use `--clobber` so partial uploads from a prior failed run are replaced. The environment name is intentionally generic (`release`) rather than maven-central-specific because the gated job covers the full release flow — tag creation, GitHub Release, Sonatype publish, and Maven Central sync wait — not just the Sonatype step. `CONTRIBUTING.md` gains a Releasing section documenting the end-to-end flow, the SHA-pinning requirement, the approval gate, the re-publish behavior, the scoped environment secrets, and a note that there is no version constant to bump in source because the version is derived from git tags at build time by `generateVersion()` in `build.gradle`. `scripts/release.sh` is retained as a local fallback.
3c20387 to
8772f1a
Compare
Andrew Kent (realark)
approved these changes
May 20, 2026
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.
resolves https://linear.app/braintrustdata/issue/BT-5168/set-up-publish-workflow-environment-rules-for-java-sdk
Adds a new
Releaseworkflow (.github/workflows/release.yml) so release managers can cut a release entirely from the Actions UI instead of pushing tags from a local checkout.Flow:
version=vX.Y.Z(optionalref, defaults tomain).-SNAPSHOT, checks the tag does not already exist locally or on origin, runs./gradlew checkon the chosen ref, then creates an annotated tag and pushes it.BRAINTRUST_BOT_APP_ID/BRAINTRUST_BOT_PRIVATE_KEY) so downstream workflows are triggered. The defaultGITHUB_TOKENdoes not retrigger workflows on push.The existing
publish-release-from-tag.ymlis unchanged in behavior but now declaresenvironment: releaseon itsvalidate-and-publishjob. This gates the entire job (CI re-check, GitHub Release creation + jar uploads, Sonatype publish, Maven Central sync wait) behind the protectedreleaseGitHub Environment. Required reviewers must approve the run before any artifacts are published.