-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to upload to Maven Central (#229)
* Add workflow to upload to Maven Central * Add JDK 17
- Loading branch information
Showing
3 changed files
with
34 additions
and
42 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
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 |
---|---|---|
@@ -1,53 +1,34 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: Release to Maven Central | ||
|
||
# Run this manually | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
releaseType: | ||
description: MAJOR, MINOR or PATCH release | ||
default: 'PATCH' | ||
dry_run: | ||
description: Whether to perform a dry run instead of a full release. | ||
default: false | ||
releaseversion: | ||
description: 'Release version' | ||
required: true | ||
default: '1.1.0' | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
release: | ||
name: Preparing Build Environment | ||
|
||
# The type of runner that the job will run on | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Set up JDK 1.8 | ||
uses: actions/[email protected] | ||
with: | ||
java-version: 1.8 | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
|
||
- name: Install Maven | ||
uses: aahmed-se/setup-maven@v3 | ||
with: | ||
maven-version: 3.6.1 | ||
|
||
- run: echo "Will start a Maven Central upload with version ${{ github.event.inputs.releaseversion }}" | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build & Test | ||
run: mvn -B test --file pom.xml | ||
|
||
- name: Prepare Release | ||
env: | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
run: mvn -B release:clean release:prepare -DRELEASE_TYPE=$INPUT_RELEASETYPE -DdryRun=$INPUT_DRY_RUN | ||
|
||
- name: Perform Release | ||
if: ${{ env.INPUT_DRY_RUN == false }} | ||
- name: Set up Maven Central Repository | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} # Value of the GPG private key to import | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase | ||
- name: Set projects Maven version to GitHub Action GUI set version | ||
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" | ||
- name: Publish package | ||
run: mvn -B --no-transfer-progress deploy -DskipTests=true | ||
env: | ||
ossrc-username: ${{ secrets.ossrc_username }} | ||
ossrc-password: ${{ secrets.ossrc_password }} | ||
run: mvn -B release:perform | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} |
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