Skip to content

Commit 4d24b2b

Browse files
authored
Merge pull request #31 from cryptlex/build/mvn-changes
ci: publish to maven central
2 parents 8a93837 + d38a92b commit 4d24b2b

3 files changed

Lines changed: 52 additions & 32 deletions

File tree

.github/workflows/maven-publish.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,26 @@ jobs:
4242
- name: Assemble Resources
4343
run: ./download-libs.sh
4444

45-
- name: Set up JDK 11
46-
uses: actions/setup-java@v2
45+
- name: Set up JDK 11 and Maven settings + GPG
46+
uses: actions/setup-java@v4
4747
with:
48-
distribution: 'adopt'
49-
java-version: '11'
48+
distribution: 'temurin'
49+
java-version: '11'
50+
server-id: central
51+
server-username: MAVEN_USERNAME
52+
server-password: MAVEN_PASSWORD
53+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
54+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
5055

5156
- name: Check Maven version
5257
run: mvn -version
5358

5459
- name: Update Version in pom.xml
5560
run: mvn -B versions:set -DnewVersion=${{ github.event.inputs.packageVersion }} -DgenerateBackupPoms=false
5661

57-
- name: Publish Maven package
58-
uses: samuelmeuli/action-maven-publish@v1
59-
with:
60-
maven_args: "-e -X -Drevision=${{ github.event.inputs.packageVersion }}"
61-
server_id: ossrh
62-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
63-
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
64-
nexus_username: ${{ secrets.MAVEN_USERNAME }}
65-
nexus_password: ${{ secrets.MAVEN_PASSWORD }}
62+
- name: Publish to Central Portal
63+
run: mvn -B -e clean deploy -Pdeploy -Drevision=${{ github.event.inputs.packageVersion }}
64+
env:
65+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
66+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} # Central Portal token
67+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test Maven Publish
2+
3+
on:
4+
pull_request:
5+
branches: ['**'] # Also on PRs to any branch
6+
7+
jobs:
8+
test-publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Assemble Resources
14+
run: ./download-libs.sh
15+
16+
- name: Set up JDK 11 and Maven settings + GPG
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: 'temurin'
20+
java-version: '11'
21+
server-id: central
22+
server-username: ${{ secrets.MAVEN_USERNAME }}
23+
server-password: ${{ secrets.MAVEN_PASSWORD }}
24+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
25+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
26+
27+
- name: Test Full Deploy (No Publishing)
28+
run: mvn -B clean deploy -Pdeploy -Drevision=1.0.0-test -DskipPublishing=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}

pom.xml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
</licenses>
1919

2020
<organization>
21-
<name>Cryptlex, LLC.</name>
21+
<name>Cryptlex, LLP.</name>
2222
<url>https://cryptlex.com</url>
2323
</organization>
2424

2525
<developers>
2626
<developer>
2727
<name>Cryptlex Team</name>
2828
<email>support@cryptlex.com</email>
29-
<organization>Cryptlex, LLC.</organization>
29+
<organization>Cryptlex, LLP.</organization>
3030
<organizationUrl>https://cryptlex.com</organizationUrl>
3131
</developer>
3232
</developers>
@@ -50,17 +50,6 @@
5050
</dependency>
5151
</dependencies>
5252

53-
<distributionManagement>
54-
<snapshotRepository>
55-
<id>ossrh</id>
56-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
57-
</snapshotRepository>
58-
<repository>
59-
<id>ossrh</id>
60-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
61-
</repository>
62-
</distributionManagement>
63-
6453
<properties>
6554
<revision>1.0.0</revision>
6655
<maven.test.skip>true</maven.test.skip>
@@ -92,14 +81,15 @@
9281
</plugin>
9382

9483
<plugin>
95-
<groupId>org.sonatype.plugins</groupId>
96-
<artifactId>nexus-staging-maven-plugin</artifactId>
97-
<version>1.6.8</version>
84+
<groupId>org.sonatype.central</groupId>
85+
<artifactId>central-publishing-maven-plugin</artifactId>
86+
<version>0.8.0</version>
9887
<extensions>true</extensions>
9988
<configuration>
100-
<serverId>ossrh</serverId>
101-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
102-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
89+
<publishingServerId>central</publishingServerId>
90+
<autoPublish>true</autoPublish>
91+
<tokenAuth>true</tokenAuth>
92+
<waitUntil>published</waitUntil>
10393
</configuration>
10494
</plugin>
10595

0 commit comments

Comments
 (0)