updated version of dependency-check-maven in pom.xml #15
This file contains hidden or 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 Publish Maven Project | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Maven | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: maven | |
| - name: Run tests (and validate build) | |
| run: mvn clean verify -P license,owasp | |
| deploy: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Maven | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: maven | |
| server-username: MAVEN_USER | |
| server-password: MAVEN_PW | |
| server-id: central | |
| - name: Import GPG private key | |
| run: | | |
| mkdir -p ~/.gnupg | |
| echo "$MAVEN_GPG_KEY" | gpg --batch --import | |
| echo "$MAVEN_GPG_PASSPHRASE" | gpg --batch --passphrase-fd 0 --import-ownertrust | |
| env: | |
| MAVEN_GPG_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSPHRASE }} | |
| - name: Build and deploy | |
| run: mvn clean deploy -B -Prelease -DskipTests -Dgpg.useagent=true assembly:single | |
| env: | |
| MAVEN_USER: ${{ secrets.OSSRH_USERNAME }} | |
| MAVEN_PW: ${{ secrets.OSSRH_PASSWORD }} | |
| MAVEN_GPG_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSPHRASE }} | |
| SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | |
| SONATYPE_PWD: ${{ secrets.SONATYPE_PWD }} | |