Skip to content

Commit 63460db

Browse files
AaronAtDuoclaude
andauthored
Migrate Maven Central publishing from OSSRH to Central Portal (#53)
Replace the deprecated nexus-staging-maven-plugin with central-publishing-maven-plugin 0.9.0. Update GitHub Actions (checkout v4, setup-java v4) and bump JDK to 11 in the deploy workflow. Bump maven-gpg-plugin, maven-source-plugin, and maven-javadoc-plugin to current versions. Pin all public GitHub Actions to commit SHAs in both CI and deploy workflows. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2fb424b commit 63460db

3 files changed

Lines changed: 23 additions & 22 deletions

File tree

.github/workflows/java-ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
java-version: [1.8, 11, 17, 21]
17+
java-version: [8, 11, 17, 21]
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2121

2222
- name: Set up Java
23-
uses: actions/setup-java@v1
23+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
2424
with:
25+
distribution: 'temurin'
2526
java-version: ${{ matrix.java-version }}
2627

2728
- name: Inject dummy example config

.github/workflows/maven-deploy.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,35 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1111

12-
- name: Set up JDK 1.8
13-
uses: actions/setup-java@v1
12+
- name: Set up JDK 11
13+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
1414
with:
15-
java-version: 1.8
15+
java-version: '11'
16+
distribution: 'temurin'
1617

1718
- name: Build with Maven
1819
run: mvn -B package
19-
20+
2021
- name: Generate sbom output
2122
run: mvn org.cyclonedx:cyclonedx-maven-plugin:makeBom && mv ./duo-universal-sdk/target/cyclonedx-sbom.json ./cyclonedx-sbom.json
2223

2324
- name: Convert SBOM
2425
uses: duosecurity/duo_client_python/.github/actions/sbom-convert@master
2526

2627
- name: Archive SBOM artifacts
27-
uses: actions/upload-artifact@v4
28+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2829
with:
2930
name: duo_universal_java_sbom
3031
path: spdx.json
3132

3233
- name: Set up Apache Maven Central
33-
uses: actions/setup-java@v1
34+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
3435
with:
35-
java-version: 1.8
36-
server-id: ossrh
36+
java-version: '11'
37+
distribution: 'temurin'
38+
server-id: central
3739
server-username: MAVEN_USERNAME # env variable for username in deploy
3840
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
3941
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import

duo-universal-sdk/pom.xml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,21 @@
3535
<id>release</id>
3636
<build>
3737
<plugins>
38-
<!-- This is used to release our package to OSSHR and Maven -->
38+
<!-- This is used to release our package to Maven Central via the Central Portal -->
3939
<plugin>
40-
<groupId>org.sonatype.plugins</groupId>
41-
<artifactId>nexus-staging-maven-plugin</artifactId>
42-
<version>1.6.8</version>
40+
<groupId>org.sonatype.central</groupId>
41+
<artifactId>central-publishing-maven-plugin</artifactId>
42+
<version>0.9.0</version>
4343
<extensions>true</extensions>
4444
<configuration>
45-
<serverId>ossrh</serverId>
46-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
47-
<autoReleaseAfterClose>false</autoReleaseAfterClose>
45+
<publishingServerId>central</publishingServerId>
4846
</configuration>
4947
</plugin>
5048
<!-- This plugin is used to sign our package with our GPG keys -->
5149
<plugin>
5250
<groupId>org.apache.maven.plugins</groupId>
5351
<artifactId>maven-gpg-plugin</artifactId>
54-
<version>1.5</version>
52+
<version>3.2.7</version>
5553
<executions>
5654
<execution>
5755
<id>sign-artifacts</id>
@@ -72,7 +70,7 @@
7270
<plugin>
7371
<groupId>org.apache.maven.plugins</groupId>
7472
<artifactId>maven-source-plugin</artifactId>
75-
<version>2.2.1</version>
73+
<version>3.3.1</version>
7674
<executions>
7775
<execution>
7876
<id>attach-sources</id>
@@ -86,7 +84,7 @@
8684
<plugin>
8785
<groupId>org.apache.maven.plugins</groupId>
8886
<artifactId>maven-javadoc-plugin</artifactId>
89-
<version>2.9.1</version>
87+
<version>3.11.2</version>
9088
<executions>
9189
<execution>
9290
<id>attach-javadocs</id>

0 commit comments

Comments
 (0)