This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
Update build-deploy.yml #6
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, Deploy, Release - maven central | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- 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: MVN_DEPLOY_USER | |
server-password: MVN_DEPLOY_PASSWORD | |
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }} | |
gpg-passphrase: GPG_PASSPHRASE | |
- name: Build and Publish to Apache Maven Central | |
run: mvn clean deploy | |
env: | |
MVN_DEPLOY_USER: ${{ secrets.ORG_OSSRH_USERNAME }} | |
MVN_DEPLOY_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} | |
- name: Get package version | |
run: | | |
PKGVER=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version | grep -v INFO | grep -E "\d") | |
git tag -d "$PKGVER" || true | |
git tag -a -m "auto-created by CI" "$PKGVER" | |
git push origin --tags |