From 45df4d5947d6dbcf9152433a642ef124824b847d Mon Sep 17 00:00:00 2001 From: Andreas Kuhtz Date: Tue, 31 Dec 2024 15:23:48 +0100 Subject: [PATCH] Deploy master to sonatype repo --- .github/workflows/build.yml | 27 +++++++++++++++++++++++++-- .github/workflows/settings.xml | 14 ++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/settings.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e158b07..24d947d 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,25 @@ 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 + 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..c126f07 --- /dev/null +++ b/.github/workflows/settings.xml @@ -0,0 +1,14 @@ + + + + + ossrh + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + + + gpg.passphrase + ${env.GPG_PASSPHRASE} + + + \ No newline at end of file