diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c32ec19b..2a12d74d 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -6,6 +6,7 @@ name: Java CI with Maven on: push: branches: [master] + tags: ["**"] pull_request: branches: [master] @@ -26,6 +27,17 @@ jobs: distribution: "adopt" - name: Build with Maven run: mvn test -B + - name: Import signing key + if: ${{ github.ref_type == 'tag' }} + env: + ARTIFACT_SIGNING_PRIVATE_KEY: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} + run: echo "$ARTIFACT_SIGNING_PRIVATE_KEY" | gpg --import + - name: Release to Maven Central + if: ${{ github.ref_type == 'tag' }} + env: + SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + run: mvn --activate-profiles release deploy --batch-mode --settings .maven_settings.xml labeler: needs: build diff --git a/.maven_settings.xml b/.maven_settings.xml new file mode 100644 index 00000000..5cc4c029 --- /dev/null +++ b/.maven_settings.xml @@ -0,0 +1,10 @@ + + + + ossrh + ${env.SONATYPE_NEXUS_USERNAME} + ${env.SONATYPE_NEXUS_PASSWORD} + + +