-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(central): add configurations for JReleaser publication to Maven Ce…
…ntral (#338)
- Loading branch information
1 parent
ebb773d
commit 87af41a
Showing
3 changed files
with
194 additions
and
2 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,54 @@ | ||
# Inspired from https://foojay.io/today/how-to-release-a-java-module-with-jreleaser-to-maven-central-with-github-actions/ | ||
name: Publish a new release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Release version' | ||
required: true | ||
nextVersion: | ||
description: 'Next version after release (-SNAPSHOT will be added automatically)' | ||
required: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Java setup | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Run a build of the code base before release | ||
run: ./mvnw --batch-mode --no-transfer-progress clean install | ||
- name: Set release version | ||
run: ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${{ github.event.inputs.version }} | ||
- name: Commit & Push changes | ||
uses: actions-js/push@v1.4 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
message: "Releasing version ${{ github.event.inputs.version }}" | ||
- name: Release with JReleaser | ||
env: | ||
JRELEASER_TAG_NAME: ${{ github.event.inputs.version }} | ||
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_PUBLIC_KEY }} | ||
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_SECRET_KEY }} | ||
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} | ||
JRELEASER_NEXUS2_USERNAME: ${{ secrets.MAVEN_CENTRAL_NEXUS2_USERNAME }} | ||
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.MAVEN_CENTRAL_NEXUS2_PASSWORD }} | ||
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: ./release.sh | ||
- name: Set the next release version | ||
run: ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${{ github.event.inputs.nextVersion }}-SNAPSHOT | ||
- name: Commit & Push changes | ||
uses: actions-js/push@v1.4 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
message: "Setting version ${{ github.event.inputs.nextVersion }}-SNAPSHOT" | ||
|
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
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,11 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
echo "📦 Staging artifacts..." | ||
./mvnw --batch-mode --no-transfer-progress -Ppublication -DskipTests=true -Dskip.spotless=true | ||
|
||
echo "🚀 Releasing..." | ||
./mvnw --batch-mode --no-transfer-progress -Prelease jreleaser:full-release | ||
|
||
echo "🎉 Done!" |