Skip to content

Commit c4d9af0

Browse files
committed
Deploy/Publish with Njord to Central Portal
1 parent 221424c commit c4d9af0

2 files changed

Lines changed: 28 additions & 27 deletions

File tree

.github/workflows/maven.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
distribution: 'temurin'
5454
java-version: ${{ matrix.jdk }}
5555
# generate settings.xml with the correct values
56-
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
56+
server-id: sonatype-central-portal # Value of the distributionManagement/repository/id field of the pom.xml
5757
server-username: MAVEN_USERNAME # env variable for username in deploy
5858
server-password: MAVEN_PASSWORD # env variable for token in deploy
5959

@@ -64,8 +64,8 @@ jobs:
6464
if [ "${{ matrix.isMainBuildEnv }}" = "true" ]; then
6565
echo "MVN_ADDITIONAL_OPTS=-Dsonar.projectKey=Netcentric_aem-cloud-validator -Dsonar.organization=netcentric -Dsonar.host.url=https://sonarcloud.io -Pjacoco-report -Dsonar.scanner.skipJreProvisioning=true" >> $GITHUB_ENV
6666
if [ "${{github.ref}}" = "refs/heads/main" ] && [ "${{github.event_name}}" = "push" ]; then
67-
echo "MAVEN_USERNAME=${{ secrets.OSSRH_TOKEN_USER }}" >> $GITHUB_ENV
68-
echo "MAVEN_PASSWORD=${{ secrets.OSSRH_TOKEN_PASSWORD }}" >> $GITHUB_ENV
67+
echo "MAVEN_USERNAME: ${{ secrets.SONATYPE_CENTRAL_TOKEN_USER }}" >> $GITHUB_ENV
68+
echo "MAVEN_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_TOKEN_PASSWORD }}" >> $GITHUB_ENV
6969
echo "MVN_GOAL=clean deploy org.sonarsource.scanner.maven:sonar-maven-plugin:5.5.0.6356:sonar" >> $GITHUB_ENV
7070
echo "STEP_NAME_SUFFIX=(Deploys to OSSRH)" >> $GITHUB_ENV
7171
else

pom.xml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
</scm>
4141
<distributionManagement>
4242
<snapshotRepository>
43-
<id>ossrh</id>
44-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
43+
<id>sonatype-central-portal</id>
44+
<url>https://central.sonatype.com/repository/maven-snapshots</url>
4545
</snapshotRepository>
4646
<repository>
47-
<id>ossrh</id>
48-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
47+
<id>sonatype-central-portal</id>
48+
<url>https://repo.maven.apache.org/maven2</url>
4949
</repository>
5050
</distributionManagement>
5151

@@ -56,6 +56,14 @@
5656
<maven.compiler.release>${java.target.version}</maven.compiler.release>
5757
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5858
<arguments /> <!-- additional arguments for the forked Maven run during releases -->
59+
<njord.version>0.9.4</njord.version>
60+
<!-- https://maveniverse.eu/docs/njord/configuration/#global-properties -->
61+
<njord.autoPublish>true</njord.autoPublish>
62+
<njord.publishingType>automatic</njord.publishingType>
63+
<njord.waitForStates>true</njord.waitForStates>
64+
<njord.publisher>sonatype-cp</njord.publisher>
65+
<njord.releaseUrl>njord:template:release-sca</njord.releaseUrl>
66+
<njord.snapshotUrl>njord:template:snapshot</njord.snapshotUrl>
5967
</properties>
6068

6169
<dependencies>
@@ -125,6 +133,14 @@
125133
</dependencies>
126134

127135
<build>
136+
<extensions>
137+
<!-- Njord extension for Maven, responsible for injecting the right repository -->
138+
<extension>
139+
<groupId>eu.maveniverse.maven.njord</groupId>
140+
<artifactId>extension3</artifactId>
141+
<version>${njord.version}</version>
142+
</extension>
143+
</extensions>
128144
<pluginManagement>
129145
<plugins>
130146
<plugin>
@@ -184,11 +200,6 @@
184200
<artifactId>maven-gpg-plugin</artifactId>
185201
<version>3.2.8</version>
186202
</plugin>
187-
<plugin>
188-
<groupId>org.sonatype.plugins</groupId>
189-
<artifactId>nexus-staging-maven-plugin</artifactId>
190-
<version>1.6.8</version>
191-
</plugin>
192203
<plugin>
193204
<groupId>org.codehaus.mojo</groupId>
194205
<artifactId>license-maven-plugin</artifactId>
@@ -203,6 +214,11 @@
203214
<artifactId>maven-invoker-plugin</artifactId>
204215
<version>3.9.1</version>
205216
</plugin>
217+
<plugin>
218+
<groupId>eu.maveniverse.maven.plugins</groupId>
219+
<artifactId>njord</artifactId>
220+
<version>${njord.version}</version>
221+
</plugin>
206222
</plugins>
207223
</pluginManagement>
208224
<plugins>
@@ -281,21 +297,6 @@
281297
<scmReleaseCommitComment>@{prefix} prepare release @{releaseLabel} [skip ci]</scmReleaseCommitComment>
282298
</configuration>
283299
</plugin>
284-
<plugin>
285-
<groupId>org.sonatype.plugins</groupId>
286-
<artifactId>nexus-staging-maven-plugin</artifactId>
287-
<extensions>true</extensions>
288-
<configuration>
289-
<serverId>ossrh</serverId>
290-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
291-
<!-- manually release in https://oss.sonatype.org/#stagingRepositories after the Maven release build -->
292-
<autoReleaseAfterClose>false</autoReleaseAfterClose>
293-
<!-- workarounds to make releasing possible at times when ossrh is really slow -->
294-
<stagingProgressTimeoutMinutes>15</stagingProgressTimeoutMinutes>
295-
<keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
296-
</configuration>
297-
</plugin>
298-
299300
<plugin>
300301
<groupId>org.codehaus.mojo</groupId>
301302
<artifactId>license-maven-plugin</artifactId>

0 commit comments

Comments
 (0)