Deploy to MVN Central #87
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
name: Deploy to MVN Central | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseVersion: | |
description: "Default version to use when preparing a release." | |
required: true | |
default: "X.Y" | |
developmentVersion: | |
description: "Default version to use for new local working copy." | |
required: true | |
default: "X.Y-SNAPSHOT" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Master | |
uses: actions/checkout@v1 | |
# with: | |
# path: master | |
- name: Switch to master | |
run: git switch -c release-${{ github.event.inputs.releaseVersion }} | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: "16.x" | |
- name: Configure Git User | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
- name: Set up JDK 1.16 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.16 | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Setup SSH Access for Commit | |
uses: kielabokkie/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.COMMIT_SSH_PRIVATE_KEY }} | |
ssh-host: github.com | |
- id: install-gpg-cert | |
name: Install GPG secret key | |
run: | | |
cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --yes --always-trust --import | |
# env: | |
# GPG_TTY: $(tty) | |
- name: Build with Maven | |
run: mvn --no-transfer-progress release:prepare release:perform -P sign-it -Dsign=true -Darguments=-Dgpg.passphrase=$MAVEN_GPG_PASSPHRASE -Dgpg.passphrase=$MAVEN_GPG_PASSPHRASE -s .settings/settings.xml -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} | |
env: | |
# GPG_TTY: $(tty) | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHASE }} | |
COMMIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} |