diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e158b07..1b98507 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,8 @@ name: Java CI -on: [push, pull_request] +on: + - push + - pull_request jobs: build: @@ -27,4 +29,27 @@ jobs: - name: Show Maven version run: mvn --version - name: Build with Maven - run: mvn --batch-mode --update-snapshots verify \ No newline at end of file + run: mvn --batch-mode --update-snapshots verify + deploy: + if: contains( github.ref, 'master') + needs: build + name: Deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 8 + server-id: ossrh + server-username: OSSRH_USERNAME # env variable for username in deploy + server-password: OSSRH_PASSWORD # env variable for token in deploy + gpg-private-key: "${{ secrets.GPG_SIGNING_KEY }}" + overwrite-settings: false + - name: Deploy snapshot artifacts + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: mvn --batch-mode deploy --settings .github/workflows/settings.xml -Dpgp.keyname=${{ secrets.GPG_KEY_NAME }} -DskipTests=true -Prelease-sign-artifacts diff --git a/.github/workflows/settings.xml b/.github/workflows/settings.xml new file mode 100644 index 0000000..350a0f5 --- /dev/null +++ b/.github/workflows/settings.xml @@ -0,0 +1,24 @@ + + + + + sonatype-nexus-snapshots + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + + + sonatype-nexus-staging + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + + + ossrh + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + + + gpg.passphrase + ${env.GPG_PASSPHRASE} + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6edd686..751bd3d 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,19 @@ + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + sonatype-nexus-staging + Nexus Staging Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + net.java.dev.jna