From 02395989ff5149fa0a2db4ca419951828ef3ecc3 Mon Sep 17 00:00:00 2001 From: Maximiliano Osorio Date: Wed, 31 Jul 2024 18:26:06 -0400 Subject: [PATCH] add: GitHub action publish on central portal (#14) * fix: test publish * fix: Inappropriate ioctl for device * fix: force * fix: user missed * fix: username missed * fix: simple * fix: change version * fix: build * fix: test using 1.7.0 * test: https://central.sonatype.org/publish/publish-portal-maven/#introduction * Revert "test: https://central.sonatype.org/publish/publish-portal-maven/#introduction" This reverts commit b418dc85dcdb8702c279ed792b82cf68ff124c4d. * Revert "Revert "test: https://central.sonatype.org/publish/publish-portal-maven/#introduction"" This reverts commit 17ce3454a31e2b368428e38b8459bd87a3737aa5. * fix: publish * fix: release * fix: prepare release --- .github/workflows/maven-publish.yml | 73 +++++++++++++++++++++-------- pom.xml | 24 ++++------ 2 files changed, 63 insertions(+), 34 deletions(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 55f5562..9e5d442 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -1,6 +1,3 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path - name: Maven Package on: @@ -9,27 +6,63 @@ on: jobs: build: - runs-on: ubuntu-latest permissions: contents: read packages: write steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'temurin' - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + server-id: ossrh + settings-path: ${{ github.workspace }} + + - name: Import GPG key + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + run: | + echo "$GPG_PRIVATE_KEY" | gpg --batch --yes --import + gpg --list-secret-keys + + - name: Verify GPG Passphrase + env: + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + echo "test message" | gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --sign --local-user maxiosorio@gmail.com + + - name: Set up Maven settings + run: | + mkdir -p ~/.m2 + echo " + + + central + ${{ secrets.OSSRH_USERNAME }} + ${{ secrets.OSSRH_PASSWORD }} + + + + + gpg-sign + + gpg + maxiosorio@gmail.com + ${{ secrets.GPG_PASSPHRASE }} + + + + + gpg-sign + + " > ~/.m2/settings.xml - - name: Build with Maven - run: mvn -B package --file pom.xml - - - name: Publish to GitHub Packages Apache Maven - run: mvn deploy - env: - GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }} - GITHUB_TOKEN: ${{ github.token }} + - name: Publish to OSSRH + run: mvn deploy + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/pom.xml b/pom.xml index 6ebcc49..f069d58 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ edu.isi.kcap ontapi - 1.3.8 + 1.4.0 @@ -64,13 +64,6 @@ 1.8 - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - @@ -152,14 +145,17 @@ maven-unit-test - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 + org.sonatype.central + central-publishing-maven-plugin + 0.5.0 true - ossrh - https://s01.oss.sonatype.org/ - true + central + + central + true + published +