From 5c6279dbe097b7c2ee14e13e72ccc9193a2c736f Mon Sep 17 00:00:00 2001 From: Carl Fluke Date: Wed, 3 Jun 2026 11:10:22 -0400 Subject: [PATCH 1/2] Use release environment secrets and add manual publish dispatch. Publish credentials should live in the release environment, and operators need a way to re-run publish without recreating a GitHub Release. Co-authored-by: Cursor --- .github/workflows/publish.yml | 16 ++++++++++++---- DEPLOY.md | 8 +++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2a25181..4c5d66b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,17 @@ -# Publish release artifacts to Maven Central when a GitHub Release is created. -# See DEPLOY.md for required repository secrets and release process. +# Publish release artifacts to Maven Central when a GitHub Release is created, +# or when this workflow is run manually from the Actions tab. +# See DEPLOY.md for required release environment secrets and release process. name: publish on: release: types: [created] + workflow_dispatch: + inputs: + tag: + description: Release tag to publish (for example v1.2.0) + required: true + type: string permissions: contents: read @@ -12,6 +19,7 @@ permissions: jobs: publish: runs-on: ubuntu-latest + environment: release steps: - name: Harden the runner (Audit all outbound calls) @@ -22,7 +30,7 @@ jobs: - name: Checkout release tag uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - ref: ${{ github.event.release.tag_name }} + ref: ${{ github.event.release.tag_name || github.event.inputs.tag }} - name: Setup Java and Maven Central credentials uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 @@ -47,7 +55,7 @@ jobs: -DnewVersion="$VERSION" \ -DgenerateBackupPoms=false env: - TAG_NAME: ${{ github.event.release.tag_name }} + TAG_NAME: ${{ github.event.release.tag_name || github.event.inputs.tag }} - name: Verify formatting run: mvn -B spotless:check diff --git a/DEPLOY.md b/DEPLOY.md index e6f8ab1..d25a806 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -13,11 +13,13 @@ This project publishes through the [Sonatype Central Portal](https://central.son ## Publish with GitHub Actions -Creating a [GitHub Release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release) runs [`.github/workflows/publish.yml`](.github/workflows/publish.yml). The workflow checks out the release tag, aligns `pom.xml` version with the tag (for example `v1.2.0` → `1.2.0`), runs Spotless and tests, then runs `mvn clean deploy`. +Creating a [GitHub Release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release) runs [`.github/workflows/publish.yml`](.github/workflows/publish.yml). You can also run the workflow manually from **Actions → publish → Run workflow**, providing the release tag (for example `v1.2.0`). -### Repository secrets +The workflow checks out the release tag, aligns `pom.xml` version with the tag (for example `v1.2.0` → `1.2.0`), runs Spotless and tests, then runs `mvn clean deploy`. -Configure these under **Settings → Secrets and variables → Actions**: +### Release environment secrets + +Configure these under **Settings → Environments → release → Environment secrets** (the publish job uses the `release` environment): | Secret | Description | |--------|-------------| From ba3ad7f0178f6554410ee17f86b030d9fd831167 Mon Sep 17 00:00:00 2001 From: Carl Fluke Date: Wed, 3 Jun 2026 11:10:56 -0400 Subject: [PATCH 2/2] Document triggering publish workflow from the GitHub CLI. Co-authored-by: Cursor --- DEPLOY.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/DEPLOY.md b/DEPLOY.md index d25a806..16ecfae 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -17,6 +17,27 @@ Creating a [GitHub Release](https://docs.github.com/en/repositories/releasing-pr The workflow checks out the release tag, aligns `pom.xml` version with the tag (for example `v1.2.0` → `1.2.0`), runs Spotless and tests, then runs `mvn clean deploy`. +### Trigger manually from the CLI + +Use the [GitHub CLI](https://cli.github.com/) (`gh auth login` if needed). From a clone of this repo: + +```bash +gh workflow run publish -f tag=v1.2.0 +``` + +From another directory, pass the repository explicitly: + +```bash +gh workflow run publish --repo coinbase/core-java -f tag=v1.2.0 +``` + +Watch the latest run or list recent publish runs: + +```bash +gh run watch +gh run list --workflow=publish +``` + ### Release environment secrets Configure these under **Settings → Environments → release → Environment secrets** (the publish job uses the `release` environment):