This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
Release to maven central #7
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: Build and Release to maven central | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- id: install-secret-key | |
name: Install gpg secret key | |
run: | | |
cat <(echo -e "${{ secrets.ORG_GPG_PRIVATE_KEY }}") | gpg --batch --import | |
gpg --list-secret-keys --keyid-format LONG | |
- name: Set up Apache Maven Central | |
uses: actions/setup-java@v3 | |
with: # configure settings.xml | |
distribution: 'temurin' | |
java-version: '11' | |
server-id: ossrh | |
server-username: OSSRH_USER | |
server-password: OSSRH_PASSWORD | |
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }} | |
gpg-passphrase: GPG_PASSPHRASE | |
- if: github.event.release | |
name: Update version in pom.xml (Release only) | |
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false | |
- name: Build and Release to Maven central | |
run: mvn -Prelease --batch-mode clean deploy | |
env: | |
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} |