Publish the artifact in SonaType or other Maven artifactory #5 #116
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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Java CI with Maven | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure GPG Key | |
run: | | |
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import --batch | |
env: | |
GPG_SIGNING_KEY: ${{ secrets.SIGNING_KEY_BASE64 }} | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }} | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
server-id: ossrh | |
server-username: OSSRH_USERNAME | |
server-password: OSSRH_TOKEN | |
gpg-passphrase: GPG_PASSPHRASE | |
- name: Run checks | |
run: mvn verify -DskipTests | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Archive jars | |
uses: actions/upload-artifact@v3 | |
with: | |
path: target/*.jar* | |
- name: Archive pmd | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pmd-report | |
path: target/site/pmd.html | |
- name: Archive dependency check | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dependency-check-report | |
path: target/dependency-check-report.html | |
- name: Archive code coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jacoco-coverage-report | |
path: target/site/jacoco/ | |
deploy: | |
# if: github.ref == 'refs/heads/main' COMMENTED OUT FOR TESTING ONLY | |
runs-on: ubuntu-latest | |
environment: Deployment_manual | |
steps: | |
- name: Deploy to SonaType | |
run: mvn deploy --file pom.xml | |
env: | |
sonatype.username: ${{ secrets.OSSRH_USERNAME }} | |
sonatype.password: ${{ secrets.OSSRH_TOKEN }} | |
sonatype.gpg.passphrase: ${{ secrets.SIGNING_PASSWORD }} | |
sonatype.gpg.signing-key-id: ${{ secrets.SIGNING_KEY_ID }} | |
sonatype.gpg.signing-key.: ${{ secrets.SIGNING_KEY }} | |