Skip to content

Commit

Permalink
Deploy master to sonatype repo
Browse files Browse the repository at this point in the history
  • Loading branch information
akuhtz committed Dec 31, 2024
1 parent ba1427b commit 74523ef
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Java CI

on: [push, pull_request]
on:
- push
- pull_request

jobs:
build:
Expand All @@ -27,4 +29,27 @@ jobs:
- name: Show Maven version
run: mvn --version
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
run: mvn --batch-mode --update-snapshots verify
deploy:
if: contains( github.ref, 'master')
needs: build
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
server-id: ossrh
server-username: OSSRH_USERNAME # env variable for username in deploy
server-password: OSSRH_PASSWORD # env variable for token in deploy
gpg-private-key: "${{ secrets.GPG_SIGNING_KEY }}"
overwrite-settings: false
- name: Deploy snapshot artifacts
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: mvn --batch-mode deploy --settings .github/workflows/settings.xml -Dpgp.keyname=${{ secrets.GPG_KEY_NAME }} -DskipTests=true -Prelease-sign-artifacts
24 changes: 24 additions & 0 deletions .github/workflows/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<settings>
<servers>
<!-- Sonatype Nexus -->
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_PASSWORD}</password>
</server>
<server>
<id>ossrh</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_PASSWORD}</password>
</server>
<server>
<id>gpg.passphrase</id>
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
</server>
</servers>
</settings>
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@
</developer>
</developers>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Staging Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<dependencies>
<dependency>
<groupId>net.java.dev.jna</groupId>
Expand Down

0 comments on commit 74523ef

Please sign in to comment.