Skip to content

Publish the artifact in SonaType or other Maven artifactory #5 #109

Publish the artifact in SonaType or other Maven artifactory #5

Publish the artifact in SonaType or other Maven artifactory #5 #109

Workflow file for this run

# 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 "$GPG_SIGNING_KEY" | wc -c
env:
GPG_SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
- 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_KEY: ${{ secrets.SIGNING_KEY }}
GPG_KEY_NAME: ${{ secrets.SIGNING_KEY_ID }}
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-private-key: ${{ secrets.SIGNING_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Run checks
env:
# OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_KEY: ${{ secrets.SIGNING_KEY }}
GPG_KEY_NAME: ${{ secrets.SIGNING_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }}
run: mvn verify -DskipTests
- 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 }}