diff --git a/.github/workflows/package-deploy.yml b/.github/workflows/package-deploy.yml index c3ce7ea..da1486f 100644 --- a/.github/workflows/package-deploy.yml +++ b/.github/workflows/package-deploy.yml @@ -17,22 +17,46 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Set up Central Repository - uses: actions/setup-java@v3 + - name: Set up Maven Central Repository + uses: actions/setup-java@v4 with: - distribution: 'zulu' java-version: '8' - server-id: ossrh - server-username: OSSRH_USERNAME - server-password: OSSRH_TOKEN - gpg-private-key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }} - gpg-passphrase: OSSRH_GPG_PASSPHRASE - - - name: Publish to Central Repository - run: mvn deploy -P release -DskipTests + distribution: 'temurin' + + - name: Write Maven settings.xml with credentials + run: | + mkdir -p ~/.m2 + cat > ~/.m2/settings.xml < + + + central + ${{ secrets.MAVEN_CENTRAL_UN }} + ${{ secrets.MAVEN_CENTRAL_PW }} + + + + EOF + + - name: Import GPG key + run: | + echo "${{ secrets.OSSRH_GPG_PRIVATE_KEY }}" | gpg --batch --yes --import + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf + echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf + gpgconf --kill gpg-agent + gpgconf --launch gpg-agent + + - name: Set GPG_TTY + run: | + export GPG_TTY=$(tty) + echo "GPG_TTY=$GPG_TTY" >> $GITHUB_ENV + + - name: Publish package + run: mvn --batch-mode -P release deploy -DskipTests -Dgpg.passphrase=${{ secrets.OSSRH_GPG_PASSPHRASE }} env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} - OSSRH_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }} \ No newline at end of file + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_UN }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PW }} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5e8b8de..940a9e0 100644 --- a/pom.xml +++ b/pom.xml @@ -128,30 +128,8 @@ - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots/ - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - maven-compiler-plugin @@ -172,14 +150,6 @@ release - - org.apache.maven.plugins - maven-deploy-plugin - 3.1.0 - - true - - org.apache.maven.plugins maven-source-plugin @@ -210,10 +180,21 @@ ${java.version} + + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true + + true + central + + + org.apache.maven.plugins maven-gpg-plugin - 3.1.0 + 1.6 sign-artifacts @@ -223,12 +204,6 @@ - - - --pinentry-mode - loopback - -