Skip to content

Commit 857f636

Browse files
committed
chore: migrate Sonatype OSSRH to Central Portal
1 parent 1e86057 commit 857f636

File tree

7 files changed

+48
-75
lines changed

7 files changed

+48
-75
lines changed

.github/workflows/maven-pulls.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
java: [ 11, 14, 17 ]
13+
java: [ 11, 17 ]
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
- name: Set up Java
18-
uses: actions/setup-java@v1
18+
uses: actions/setup-java@v4
1919
with:
2020
java-version: ${{ matrix.java }}
21+
distribution: temurin
22+
server-id: central
23+
server-username: MAVEN_USERNAME
24+
server-password: MAVEN_PASSWORD
2125
- name: Cache local Maven repository
2226
uses: actions/cache@v4
2327
with:

.github/workflows/maven.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
java: [ 11, 14, 17 ]
13+
java: [ 11, 17 ]
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
- name: Set up Java
18-
uses: actions/setup-java@v1
18+
uses: actions/setup-java@v4
1919
with:
2020
java-version: ${{ matrix.java }}
21-
server-id: ossrh
21+
distribution: temurin
22+
server-id: central
2223
server-username: MAVEN_USERNAME
2324
server-password: MAVEN_PASSWORD
2425
- name: Cache local Maven repository
@@ -52,5 +53,5 @@ jobs:
5253
echo "not building and maven publishing project as it is a release version: " ${MY_JAVA_VERSION}
5354
fi
5455
env:
55-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
56-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
56+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
57+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

.github/workflows/prepare-release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- uses: tibdex/github-app-token@v1
1515
id: generate-token
1616
with:
@@ -21,10 +21,11 @@ jobs:
2121
with:
2222
python-version: '3.10'
2323
- name: Set up Java 11
24-
uses: actions/setup-java@v1
24+
uses: actions/setup-java@v4
2525
with:
2626
java-version: 11
27-
server-id: ossrh
27+
distribution: temurin
28+
server-id: central
2829
server-username: MAVEN_USERNAME
2930
server-password: MAVEN_PASSWORD
3031
- name: Cache local Maven repository
@@ -58,9 +59,8 @@ jobs:
5859
branch: prepare-release-${{ env.SC_VERSION }}
5960
env:
6061
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
61-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
62-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
62+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
63+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
6364
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6465
SC_VERSION:
6566
SC_NEXT_VERSION:
66-

.github/workflows/release.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- uses: tibdex/github-app-token@v1
1515
id: generate-token
1616
with:
@@ -21,12 +21,15 @@ jobs:
2121
with:
2222
python-version: '3.10'
2323
- name: Set up Java 11
24-
uses: actions/setup-java@v1
24+
uses: actions/setup-java@v4
2525
with:
2626
java-version: 11
27-
server-id: ossrh
27+
distribution: temurin
28+
server-id: central
2829
server-username: MAVEN_USERNAME
2930
server-password: MAVEN_PASSWORD
31+
gpg-private-key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
32+
gpg-passphrase: ${{ secrets.OSSRH_GPG_PRIVATE_PASSPHRASE }}
3033
- name: Cache local Maven repository
3134
uses: actions/cache@v4
3235
with:
@@ -60,22 +63,17 @@ jobs:
6063
git config --global user.name "GitHub Action"
6164
git config --global hub.protocol https
6265
git remote set-url origin https://\${{ secrets.GITHUB_TOKEN }}:[email protected]/''' + 'swagger-api/swagger-core' + '''.git
63-
- name: Run maven deploy/release (action-maven-publish)
64-
uses: samuelmeuli/action-maven-publish@v1
66+
- name: Run maven deploy/release
6567
if: env.RELEASE_OK == 'yes'
66-
with:
67-
gpg_private_key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
68-
gpg_passphrase: ${{ secrets.OSSRH_GPG_PRIVATE_PASSPHRASE }}
69-
nexus_username: ${{ secrets.OSSRH_USERNAME }}
70-
nexus_password: ${{ secrets.OSSRH_TOKEN }}
71-
maven_profiles: "release"
68+
run: |
69+
./mvnw --no-transfer-progress -B -Prelease deploy
7270
- name: Run prepare javadocs script
7371
id: prepareJavadocs
7472
if: env.RELEASE_OK == 'yes'
7573
run: |
7674
. ./CI/prepare-javadocs.sh
7775
- name: Checkout gh-pages
78-
uses: actions/checkout@v2
76+
uses: actions/checkout@v4
7977
with:
8078
ref: "gh-pages"
8179
fetch-depth: 0
@@ -86,7 +84,7 @@ jobs:
8684
TMPDIR="$(dirname -- "${0}")"
8785
. $TMPDIR/publish-javadocs.sh
8886
- name: Checkout master
89-
uses: actions/checkout@v2
87+
uses: actions/checkout@v4
9088
with:
9189
ref: "master"
9290
fetch-depth: 0
@@ -104,7 +102,7 @@ jobs:
104102
title: 'bump snapshot ${{ env.SC_NEXT_VERSION }}-SNAPSHOT'
105103
branch: bump-snap-${{ env.SC_NEXT_VERSION }}-SNAPSHOT
106104
- name: Checkout 1.5
107-
uses: actions/checkout@v2
105+
uses: actions/checkout@v4
108106
with:
109107
ref: "1.5"
110108
fetch-depth: 0
@@ -123,7 +121,7 @@ jobs:
123121
title: 'update 1.5 Readme with new v2 version ${{ env.SC_VERSION }}'
124122
branch: update-v1-readme-${{ env.SC_VERSION }}
125123
- name: Checkout Wiki
126-
uses: actions/checkout@v2
124+
uses: actions/checkout@v4
127125
with:
128126
repository: swagger-api/swagger-core.wiki
129127
token: ${{ steps.generate-token.outputs.token }}
@@ -145,8 +143,8 @@ jobs:
145143

146144
env:
147145
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
148-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
149-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
146+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
147+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
150148
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151149
SC_VERSION:
152150
SC_NEXT_VERSION:

CI/CI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ See also [here](https://github.com/peter-evans/create-pull-request/blob/master/d
8383
GPG private key and passphrase defined to be used for sonatype deployments, as detailed in
8484
https://central.sonatype.org/pages/working-with-pgp-signatures.html (I'd say with email matching the one of the sonatype account of point 1
8585

86-
* `OSSRH_USERNAME` and `OSSRH_TOKEN`: sonatype user/token
86+
* `MAVEN_CENTRAL_USERNAME` and `MAVEN_CENTRAL_PASSWORD`: sonatype user/token
8787

8888
* `GRADLE_PUBLISH_KEY` and `GRADLE_PUBLISH_SECRET`: credentials for https://plugins.gradle.org/
8989

modules/swagger-project-jakarta/pom.xml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313
<developerConnection>scm:git:[email protected]:swagger-api/swagger-core.git</developerConnection>
1414
<url>https://github.com/swagger-api/swagger-core</url>
1515
</scm>
16-
<distributionManagement>
17-
<snapshotRepository>
18-
<id>ossrh</id>
19-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
20-
</snapshotRepository>
21-
<repository>
22-
<id>ossrh</id>
23-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
24-
</repository>
25-
</distributionManagement>
2616
<prerequisites>
2717
<maven>2.2.0</maven>
2818
</prerequisites>
@@ -112,18 +102,14 @@
112102
</executions>
113103
</plugin>
114104
<plugin>
115-
<groupId>org.sonatype.plugins</groupId>
116-
<artifactId>nexus-staging-maven-plugin</artifactId>
117-
<version>1.6.13</version>
105+
<groupId>org.sonatype.central</groupId>
106+
<artifactId>central-publishing-maven-plugin</artifactId>
107+
<version>0.7.0</version>
118108
<extensions>true</extensions>
119109
<configuration>
120-
<serverId>ossrh</serverId>
121-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
122-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
123-
<stagingProgressTimeoutMinutes>30</stagingProgressTimeoutMinutes>
124-
<!-- <skipStaging>true</skipStaging>
125-
<skipRemoteStaging>true</skipRemoteStaging>
126-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>-->
110+
<publishingServerId>central</publishingServerId>
111+
<autoPublish>true</autoPublish>
112+
<waitUntil>published</waitUntil>
127113
</configuration>
128114
</plugin>
129115
</plugins>
@@ -509,7 +495,6 @@
509495
<coverage.missed.classes>0</coverage.missed.classes>
510496

511497
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
512-
<sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</sonatypeOssDistMgmtSnapshotsUrl>
513498
<transformer-maven-plugin-version>0.5.0</transformer-maven-plugin-version>
514499
<maven.version>3.9.9</maven.version>
515500
<commons-compress-version>1.27.1</commons-compress-version>

pom.xml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313
<developerConnection>scm:git:[email protected]:swagger-api/swagger-core.git</developerConnection>
1414
<url>https://github.com/swagger-api/swagger-core</url>
1515
</scm>
16-
<distributionManagement>
17-
<snapshotRepository>
18-
<id>ossrh</id>
19-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
20-
</snapshotRepository>
21-
<repository>
22-
<id>ossrh</id>
23-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
24-
</repository>
25-
</distributionManagement>
2616
<prerequisites>
2717
<maven>2.2.0</maven>
2818
</prerequisites>
@@ -208,18 +198,14 @@
208198
<version>3.12.1</version>
209199
</plugin>
210200
<plugin>
211-
<groupId>org.sonatype.plugins</groupId>
212-
<artifactId>nexus-staging-maven-plugin</artifactId>
213-
<version>1.6.13</version>
201+
<groupId>org.sonatype.central</groupId>
202+
<artifactId>central-publishing-maven-plugin</artifactId>
203+
<version>0.7.0</version>
214204
<extensions>true</extensions>
215205
<configuration>
216-
<serverId>ossrh</serverId>
217-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
218-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
219-
<stagingProgressTimeoutMinutes>30</stagingProgressTimeoutMinutes>
220-
<!-- <skipStaging>true</skipStaging>
221-
<skipRemoteStaging>true</skipRemoteStaging>
222-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>-->
206+
<publishingServerId>central</publishingServerId>
207+
<autoPublish>true</autoPublish>
208+
<waitUntil>published</waitUntil>
223209
</configuration>
224210
</plugin>
225211
</plugins>
@@ -666,6 +652,5 @@
666652
<coverage.missed.classes>0</coverage.missed.classes>
667653
<transformer-maven-plugin-version>0.5.0</transformer-maven-plugin-version>
668654
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
669-
<sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</sonatypeOssDistMgmtSnapshotsUrl>
670655
</properties>
671656
</project>

0 commit comments

Comments
 (0)