Skip to content

Merge pull request #10 from twelvet-s/master #5

Merge pull request #10 from twelvet-s/master

Merge pull request #10 from twelvet-s/master #5

name: publish maven package
on:
workflow_dispatch:
push:
branches: [ master ]
jobs:
oss-snapshot-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Setup Maven Central
uses: actions/setup-java@v3
with: # overwrite settings.xml
java-version: '17'
distribution: 'adopt'
server-id: sonatype
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Set Release version env variable
run: |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Publish to Maven Central
if: contains('${{ env.RELEASE_VERSION }}', 'SNAPSHOT')
run: mvn clean deploy -P snapshot -Dmaven.test.skip=true
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}