Skip to content

feat: drive releases from a single GitHub Actions workflow#108

Merged
Andrew Kent (realark) merged 1 commit into
mainfrom
abhi-feat-actions-driven-release
May 20, 2026
Merged

feat: drive releases from a single GitHub Actions workflow#108
Andrew Kent (realark) merged 1 commit into
mainfrom
abhi-feat-actions-driven-release

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) commented May 20, 2026

resolves https://linear.app/braintrustdata/issue/BT-5168/set-up-publish-workflow-environment-rules-for-java-sdk

Adds a new Release workflow (.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:

  1. Actions → Release → Run workflow with version=vX.Y.Z (optional ref, defaults to main).
  2. The workflow validates semver, refuses -SNAPSHOT, checks the tag does not already exist locally or on origin, runs ./gradlew check on the chosen ref, then creates an annotated tag and pushes it.
  3. The tag push uses a GitHub App token (BRAINTRUST_BOT_APP_ID / BRAINTRUST_BOT_PRIVATE_KEY) so downstream workflows are triggered. The default GITHUB_TOKEN does not retrigger workflows on push.

The existing publish-release-from-tag.yml is unchanged in behavior but now declares environment: release on its validate-and-publish job. This gates the entire job (CI re-check, GitHub Release creation + jar uploads, Sonatype publish, Maven Central sync wait) behind the protected release GitHub Environment. Required reviewers must approve the run before any artifacts are published.

Comment thread .github/workflows/release.yml Outdated
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.
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) force-pushed the abhi-feat-actions-driven-release branch from 3c20387 to 8772f1a Compare May 20, 2026 17:10
@realark Andrew Kent (realark) merged commit bdbca15 into main May 20, 2026
1 check passed
@realark Andrew Kent (realark) deleted the abhi-feat-actions-driven-release branch May 20, 2026 17:18
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.

2 participants