-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] Set up Actions-based release process (#326)
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# This workflow will build a Java project with Maven and publish it to Maven Central Repository | ||
# ref: https://github.com/actions/setup-java/blob/v3.11.0/docs/advanced-usage.md#Publishing-using-Apache-Maven | ||
|
||
# Secrets required: | ||
# - MAVEN_USERNAME: Username for Maven Central Repository | ||
# - MAVEN_CENTRAL_TOKEN: Token/password for Maven Central Repository | ||
# - MAVEN_GPG_PRIVATE_KEY: GPG private key to sign the artifacts (string) | ||
# - MAVEN_GPG_PASSPHRASE: Passphrase for the GPG private key | ||
|
||
name: Publish library to Maven Central Repository | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
secrets: | ||
MAVEN_USERNAME: | ||
required: true | ||
MAVEN_CENTRAL_TOKEN: | ||
required: true | ||
MAVEN_GPG_PRIVATE_KEY: | ||
required: true | ||
MAVEN_GPG_PASSPHRASE: | ||
required: true | ||
workflow_dispatch: ~ | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "zulu" | ||
java-version: "22" # Always use the latest JDK | ||
server-id: "ossrh" | ||
# define environmental variable names | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_CENTRAL_TOKEN | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | ||
|
||
- name: Clean, build and publish to Apache Maven Central | ||
run: make publish pass=${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||
|
||
- name: Upload output files to release | ||
uses: AButler/[email protected] | ||
with: | ||
files: "target/*.jar;target/*.pom;target/*.asc" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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