Skip to content

Commit

Permalink
Update maven-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
matheuslenke authored Dec 20, 2024
1 parent e872ce9 commit 1ea0335
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 }}

0 comments on commit 1ea0335

Please sign in to comment.