Skip to content

Commit 84f3709

Browse files
authored
[ci] publish-snapshot/release: migrate to central portal (#169)
OSSRH is being shut down, we now need to use central portal for publish artifacts to maven central. See https://central.sonatype.org/publish/publish-portal-guide/ See https://central.sonatype.org/news/20250326_ossrh_sunset/
1 parent 514945f commit 84f3709

File tree

3 files changed

+49
-51
lines changed

3 files changed

+49
-51
lines changed

.github/workflows/publish-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
7777
deploy-to-maven-central:
7878
needs: check-version
79-
# use environment maven-central, where secrets are configured for OSSRH_*
79+
# use environment maven-central, where secrets are configured for MAVEN_CENTRAL_PORTAL_*
8080
environment:
8181
name: maven-central
8282
url: https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd-designer/
@@ -96,15 +96,15 @@ jobs:
9696
distribution: 'temurin'
9797
java-version: '11'
9898
cache: 'maven'
99-
server-id: ossrh
99+
server-id: central
100100
server-username: MAVEN_USERNAME
101101
server-password: MAVEN_PASSWORD
102102
gpg-passphrase: MAVEN_GPG_PASSPHRASE
103103
gpg-private-key: ${{ secrets.PMD_CI_GPG_PRIVATE_KEY }}
104104
- name: Build and Publish
105105
env:
106-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
107-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
106+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_PORTAL_USERNAME }}
107+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PORTAL_PASSWORD }}
108108
MAVEN_GPG_PASSPHRASE: ${{ secrets.PMD_CI_GPG_PASSPHRASE }}
109109
run: |
110110
./mvnw --show-version --errors --batch-mode \

.github/workflows/publish-snapshot.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ jobs:
6767
6868
deploy-to-maven-central:
6969
needs: check-version
70-
# use environment maven-central, where secrets are configured for OSSRH_*
70+
# use environment maven-central, where secrets are configured for MAVEN_CENTRAL_PORTAL_*
7171
environment:
7272
name: maven-central
73-
url: https://oss.sonatype.org/content/repositories/snapshots/net/sourceforge/pmd/pmd-designer/
73+
url: https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/net/sourceforge/pmd/pmd-designer/
7474
runs-on: ubuntu-latest
7575
timeout-minutes: 20
7676
defaults:
@@ -85,15 +85,15 @@ jobs:
8585
distribution: 'temurin'
8686
java-version: '11'
8787
cache: 'maven'
88-
server-id: ossrh
88+
server-id: central
8989
server-username: MAVEN_USERNAME
9090
server-password: MAVEN_PASSWORD
9191
gpg-passphrase: MAVEN_GPG_PASSPHRASE
9292
gpg-private-key: ${{ secrets.PMD_CI_GPG_PRIVATE_KEY }}
9393
- name: Build and Publish
9494
env:
95-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
96-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
95+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_PORTAL_USERNAME }}
96+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PORTAL_PASSWORD }}
9797
MAVEN_GPG_PASSPHRASE: ${{ secrets.PMD_CI_GPG_PASSPHRASE }}
9898
run: |
9999
./mvnw --show-version --errors --batch-mode \

pom.xml

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@
2525
<ciManagement>
2626
<url>https://github.com/pmd/pmd-designer/actions</url>
2727
</ciManagement>
28-
<distributionManagement>
29-
<snapshotRepository>
30-
<id>ossrh</id>
31-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
32-
</snapshotRepository>
33-
<repository>
34-
<id>ossrh</id>
35-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
36-
</repository>
37-
</distributionManagement>
3828
<developers>
3929
<developer>
4030
<id>oowekyala</id>
@@ -122,6 +112,11 @@
122112
<artifactId>maven-shade-plugin</artifactId>
123113
<version>3.6.0</version>
124114
</plugin>
115+
<plugin>
116+
<groupId>org.sonatype.central</groupId>
117+
<artifactId>central-publishing-maven-plugin</artifactId>
118+
<version>0.7.0</version>
119+
</plugin>
125120
</plugins>
126121
</pluginManagement>
127122
<plugins>
@@ -393,16 +388,14 @@
393388
</plugin>
394389

395390
<plugin>
396-
<groupId>org.sonatype.plugins</groupId>
397-
<artifactId>nexus-staging-maven-plugin</artifactId>
398-
<version>1.7.0</version>
391+
<groupId>org.sonatype.central</groupId>
392+
<artifactId>central-publishing-maven-plugin</artifactId>
399393
<extensions>true</extensions>
400394
<configuration>
401-
<serverId>ossrh</serverId>
402-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
403-
<!-- if autoReleaseAfterClose is true, then the artifacts will be
404-
automatically promoted to maven central -->
405-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
395+
<publishingServerId>central</publishingServerId>
396+
<autoPublish>true</autoPublish>
397+
<waitUntil>published</waitUntil>
398+
<deploymentName>${project.artifactId}</deploymentName>
406399
</configuration>
407400
</plugin>
408401

@@ -505,31 +498,7 @@
505498
<id>local-libs</id>
506499
<url>file://${local.lib.repo}</url>
507500
</repository>
508-
<repository>
509-
<id>sonatype-nexus-snapshots</id>
510-
<name>Sonatype Nexus Snapshots</name>
511-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
512-
<releases>
513-
<enabled>false</enabled>
514-
</releases>
515-
<snapshots>
516-
<enabled>true</enabled>
517-
</snapshots>
518-
</repository>
519501
</repositories>
520-
<pluginRepositories>
521-
<pluginRepository>
522-
<id>sonatype-nexus-plugin-snapshots</id>
523-
<name>Sonatype Nexus Snapshots</name>
524-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
525-
<releases>
526-
<enabled>false</enabled>
527-
</releases>
528-
<snapshots>
529-
<enabled>true</enabled>
530-
</snapshots>
531-
</pluginRepository>
532-
</pluginRepositories>
533502

534503
<dependencyManagement>
535504
<dependencies>
@@ -1043,6 +1012,35 @@
10431012
</properties>
10441013
</profile>
10451014

1015+
<profile>
1016+
<id>central-portal-snapshots</id>
1017+
<repositories>
1018+
<repository>
1019+
<name>Central Portal Snapshots</name>
1020+
<id>central-portal-snapshots</id>
1021+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
1022+
<releases>
1023+
<enabled>false</enabled>
1024+
</releases>
1025+
<snapshots>
1026+
<enabled>true</enabled>
1027+
</snapshots>
1028+
</repository>
1029+
</repositories>
1030+
<pluginRepositories>
1031+
<pluginRepository>
1032+
<name>Central Portal Snapshots</name>
1033+
<id>central-portal-snapshots</id>
1034+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
1035+
<releases>
1036+
<enabled>false</enabled>
1037+
</releases>
1038+
<snapshots>
1039+
<enabled>true</enabled>
1040+
</snapshots>
1041+
</pluginRepository>
1042+
</pluginRepositories>
1043+
</profile>
10461044
</profiles>
10471045

10481046
</project>

0 commit comments

Comments
 (0)