Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# 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

jobs:
publish:
runs-on: ubuntu-latest
environment: release

steps:
- name: Harden the runner (Audit all outbound calls)
Expand All @@ -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
Expand All @@ -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
Expand Down
29 changes: 26 additions & 3 deletions DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,34 @@ 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**:
### 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):

| Secret | Description |
|--------|-------------|
Expand Down
Loading