Skip to content

Commit

Permalink
Pass maven deploy parameters on command line (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
tspence authored Oct 4, 2024
1 parent 799a303 commit 76d9c60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17 for deploy to Sonatype
uses: actions/setup-java@v3
- name: Set up JDK for deploy to Sonatype
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
server-id: central
server-username: ${{ secrets.MAVEN_USERNAME }}
server-password: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
distribution: 'temurin'
java-version: 21

- name: Verify with Maven
if: github.event_name == 'pull_request'
Expand All @@ -54,16 +49,14 @@ jobs:
run: export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"

- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v1
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_SIGNING_KEY }}
PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }}
passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Publish to Sonatype Central
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: mvn -B -PsonatypeDeploy deploy
run: mvn -B -PsonatypeDeploy deploy -Dserver.username="${{ secrets.MAVEN_USERNAME }}" -Dserver.password="${{ secrets.MAVEN_CENTRAL_TOKEN }}"
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
MAVEN_GPG_KEY: ${{ secrets.GPG_SIGNING_KEY }}
4 changes: 2 additions & 2 deletions settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<servers>
<server>
<id>central</id>
<username>${env.MAVEN_USERNAME}</username>
<password>${env.MAVEN_CENTRAL_TOKEN}</password>
<username>${server.username}</username>
<password>${server.password}</password>
</server>
<server>
<id>gpg.passphrase</id>
Expand Down

0 comments on commit 76d9c60

Please sign in to comment.