diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b6d711b..d964a08 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,5 @@ -name: Publish package to GitHub Packages +name: Publish package to the Maven Central Repository + on: push: branches: @@ -15,14 +16,25 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - packages: write steps: - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - name: Import GPG Key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Set up Java for publishing to Maven Central Repository + uses: actions/setup-java@v4 with: java-version: '11' distribution: 'adopt' - - name: Publish package - run: mvn --batch-mode deploy + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + - name: Publish to the Maven Central Repository + run: mvn --batch-mode deploy -Prelease env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} +