diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index c454cce..0cf1a93 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: Publish OntoUML4j to the Maven Central Repository on: @@ -11,36 +8,24 @@ jobs: publish: runs-on: ubuntu-latest steps: - - name: Set up Apache Maven Central - uses: actions/setup-java@v3 - with: # running setup-java again overwrites the settings.xml - java-version: 21 - distribution: 'temurin' - cache: 'maven' - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - server-username: OSSRH_USERNAME # env variable for username in deploy - server-password: OSSRH_TOKEN # env variable for token in deploy - gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import - gpg-passphrase: ${{ secrets.GPG_PASSWORD }} + - name: Checkout repository + uses: actions/checkout@v4 - - uses: actions/checkout@v4 - - name: Set up Maven Central Repository + - name: Set up JDK 21 uses: actions/setup-java@v4 with: java-version: '21' distribution: 'temurin' - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - + cache: 'maven' + - name: Import GPG Key run: | - echo "${{ secrets.GPG_SIGNING_KEY }}" | gpg --import - env: - GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + echo "${{ secrets.GPG_SIGNING_KEY }}" | base64 --decode | gpg --import + gpg --list-secret-keys --keyid-format LONG - name: Publish package - run: mvn --batch-mode deploy + run: | + mvn clean deploy -P release -Dgpg.passphrase=${{ secrets.GPG_PASSWORD }} -Dgpg.keyname=KEY_ID_FROM_LIST_COMMAND env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}