Skip to content

feat: Add Maven Central release workflow - #24

Merged
jiayuasu merged 4 commits into
mainfrom
ci/maven-central-release
Mar 25, 2026
Merged

feat: Add Maven Central release workflow#24
jiayuasu merged 4 commits into
mainfrom
ci/maven-central-release

Conversation

@jiayuasu

Copy link
Copy Markdown
Member

Summary

  • Adds a GitHub Actions workflow that automates publishing releases to Maven Central
  • Triggers on pushes to main that modify lib/build.gradle (i.e., version bumps)
  • Skips if the version tag already exists to prevent duplicate releases
  • Builds, signs (GPG), and publishes the artifact via publishToCentralPortal
  • Creates a GitHub release with auto-generated notes and attaches the shadow jar

Required secrets

  • GPG_PRIVATE_KEY / GPG_PASSPHRASE — for artifact signing
  • MAVEN_CENTRAL_USERNAME / MAVEN_CENTRAL_PASSWORD — Maven Central credentials

Test plan

  • Verify required secrets are configured in repo settings
  • Merge and bump version in lib/build.gradle to trigger the workflow
  • Confirm the artifact appears on Maven Central and a GitHub release is created

Automates the release process: extracts version from build.gradle,
builds and signs the artifact, publishes to Maven Central, and
creates a GitHub release with the shadow jar.
@jiayuasu
jiayuasu requested a review from a team as a code owner March 25, 2026 06:59
@jiayuasu
jiayuasu requested review from haizhou-zhao and removed request for a team March 25, 2026 06:59
@jiayuasu jiayuasu changed the title Add Maven Central release workflow feat: Add Maven Central release workflow Mar 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an automated GitHub Actions release pipeline to publish the lib artifact to Maven Central when the library version is bumped, and updates project docs/version references accordingly.

Changes:

  • Bump library version to 0.3.0 and update README dependency snippets to match.
  • Add .github/workflows/release.yml to publish/sign to Maven Central and create a GitHub release on main pushes that modify lib/build.gradle.
  • Document Java 17 runtime requirement in README.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
lib/build.gradle Version bump to 0.3.0 to drive the release trigger.
README.md Updates install snippets to 0.3.0 and clarifies Java 17 requirement.
.github/workflows/release.yml New workflow to publish to Maven Central and create a GitHub release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +48 to +55
- name: Cache Gradle packages
if: steps.tag_check.outputs.exists == 'false'
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions/cache@v3 is deprecated (Node 16) and can stop working on GitHub-hosted runners. Bump this to actions/cache@v4 (and keep it aligned with other workflows) to avoid sudden CI breakage.

Copilot uses AI. Check for mistakes.

@jiayuasu jiayuasu Mar 25, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped to actions/cache@v4.

Comment on lines +30 to +39
- name: Check if tag already exists
id: tag_check
run: |
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
echo "Tag v${{ steps.version.outputs.version }} already exists, skipping release."
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "Tag v${{ steps.version.outputs.version }} does not exist, proceeding with release."
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow can run concurrently for multiple pushes that touch lib/build.gradle. Without a concurrency group, two runs can both observe the tag as missing and attempt to publish/create the same release in parallel, leading to duplicate publish attempts or failed releases. Add a workflow/job-level concurrency key (e.g., grouped by version or by workflow) to serialize/cancel overlapping runs.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a concurrency group with cancel-in-progress: false so overlapping runs are queued rather than cancelled.

Comment on lines +58 to +60
if: steps.tag_check.outputs.exists == 'false'
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --batch --import

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPG_PRIVATE_KEY is base64-decoded before import, which means the secret must be stored base64-encoded; however the repo docs (e.g., CONTRIBUTING release prerequisites) don’t specify this encoding requirement. Either update the documentation to explicitly require base64 for GPG_PRIVATE_KEY, or remove the base64 --decode and import an ASCII-armored key directly to match typical secret setup.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment in the workflow documenting the base64 encoding requirement with the command to generate it.

- Bump actions/cache from v3 to v4 (Node 16 deprecation)
- Add concurrency group to prevent parallel release attempts
- Document base64 encoding requirement for GPG_PRIVATE_KEY secret
@jiayuasu
jiayuasu merged commit 733eac7 into main Mar 25, 2026
2 checks passed
@jiayuasu
jiayuasu deleted the ci/maven-central-release branch March 25, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants