Skip to content

Maven publishing test #7

Maven publishing test

Maven publishing test #7

Workflow file for this run

name: Publish package to the Maven Central Repository
on:
release:
types: [published]
workflow_dispatch:
pull_request:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: build artifact
run: mvn -B package --file pom.xml -DskipTests
- name: Verify Whether a Release is Ready
id: release
shell: bash
run: |
if [ "${{ github.event.inputs.releaseVersion }}" != "" ] && [ "${{ github.event.inputs.developmentVersion }}" != "" ]; then
echo "auto_release=true" >> $GITHUB_ENV
else
echo "auto_release=false" >> $GITHUB_ENV
fi
- name: Publish package
run: mvn --batch-mode deploy -e
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
AUTO_RELEASE_AFTER_CLOSE: ${{ env.auto_release }}