Skip to content

Commit 952b107

Browse files
authored
ci: wrap nexus-staging-maven-plugin with a profile (GoogleCloudPlatform#3834)
As the preparation for Central Portal API publication, we need to wrap nexus-staging-maven-plugin with a profile. The release scriptm, which uses existing OSSRH infra, is updated to activate the release-sonatype profile. The profile name matches java-shared-config. https://github.com/googleapis/java-shared-config/blob/main/native-image-shared-config/pom.xml#L112 b/422164249
1 parent 37cb89d commit 952b107

File tree

3 files changed

+75
-11
lines changed

3 files changed

+75
-11
lines changed

.kokoro/stage.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.
4444
-Dgpg.passphrase=${GPG_PASSPHRASE} \
4545
-Dgpg.homedir=${GPG_HOMEDIR} \
4646
-DperformRelease=true \
47+
-Prelease-sonatype
4748

4849
# promote release
4950
if [[ -n "${AUTORELEASE_PR}" ]]
5051
then
5152
./mvnw nexus-staging:release \
5253
--batch-mode \
5354
--settings ${MAVEN_SETTINGS_FILE} \
54-
-DperformRelease=true
55+
-DperformRelease=true \
56+
-Prelease-sonatype
5557
fi
5658

5759
popd

pom.xml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,12 @@
757757
<groupId>org.sonatype.plugins</groupId>
758758
<artifactId>nexus-staging-maven-plugin</artifactId>
759759
<version>${nexus-staging-plugin.version}</version>
760+
<extensions>true</extensions>
761+
<configuration>
762+
<serverId>ossrh</serverId>
763+
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
764+
<stagingProgressTimeoutMinutes>15</stagingProgressTimeoutMinutes>
765+
</configuration>
760766
</plugin>
761767
</plugins>
762768
</pluginManagement>
@@ -774,16 +780,6 @@
774780
</execution>
775781
</executions>
776782
</plugin>
777-
<plugin>
778-
<groupId>org.sonatype.plugins</groupId>
779-
<artifactId>nexus-staging-maven-plugin</artifactId>
780-
<extensions>true</extensions>
781-
<configuration>
782-
<serverId>ossrh</serverId>
783-
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
784-
<stagingProgressTimeoutMinutes>15</stagingProgressTimeoutMinutes>
785-
</configuration>
786-
</plugin>
787783
<plugin>
788784
<groupId>org.apache.maven.plugins</groupId>
789785
<artifactId>maven-javadoc-plugin</artifactId>
@@ -869,6 +865,41 @@
869865
</repository>
870866
</repositories>
871867
</profile>
868+
<profile>
869+
<!-- By default, we release artifacts to Sonatype, which requires
870+
nexus-staging-maven-plugin. Going forward, we'll use pure
871+
maven-deploy-plugin, and we need to turn this extension off. -->
872+
<id>release-sonatype</id>
873+
<build>
874+
<plugins>
875+
<plugin>
876+
<groupId>org.sonatype.plugins</groupId>
877+
<artifactId>nexus-staging-maven-plugin</artifactId>
878+
</plugin>
879+
</plugins>
880+
</build>
881+
</profile>
882+
<profile>
883+
<!-- Optionally, we can publish the artifacts to GCP Artifact Registry specifying
884+
this release-gcp-artifact-registry profile:
885+
mvn deploy -P=release-gcp-artifact-registry -P=-release-sonatype \
886+
-Dartifact-registry-url=artifactregistry://us-maven.pkg.dev/...
887+
-->
888+
<id>release-gcp-artifact-registry</id>
889+
<properties>
890+
<artifact-registry-url>artifactregistry://undefined-artifact-registry-url-value</artifact-registry-url>
891+
</properties>
892+
<distributionManagement>
893+
<repository>
894+
<id>gcp-artifact-registry-repository</id>
895+
<url>${artifact-registry-url}</url>
896+
</repository>
897+
<snapshotRepository>
898+
<id>gcp-artifact-registry-repository</id>
899+
<url>${artifact-registry-url}</url>
900+
</snapshotRepository>
901+
</distributionManagement>
902+
</profile>
872903
</profiles>
873904

874905
<licenses>

spring-cloud-gcp-dependencies/pom.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,16 @@
337337
</execution>
338338
</executions>
339339
</plugin>
340+
</plugins>
341+
</build>
342+
</profile>
343+
<profile>
344+
<!-- By default, we release artifacts to Sonatype, which requires
345+
nexus-staging-maven-plugin. Going forward, we'll use pure
346+
maven-deploy-plugin, and we need to turn this extension off. -->
347+
<id>release-sonatype</id>
348+
<build>
349+
<plugins>
340350
<plugin>
341351
<groupId>org.sonatype.plugins</groupId>
342352
<artifactId>nexus-staging-maven-plugin</artifactId>
@@ -351,6 +361,27 @@
351361
</plugins>
352362
</build>
353363
</profile>
364+
<profile>
365+
<!-- Optionally, we can publish the artifacts to GCP Artifact Registry specifying
366+
this release-gcp-artifact-registry profile:
367+
mvn deploy -P=release-gcp-artifact-registry -P=-release-sonatype \
368+
-Dartifact-registry-url=artifactregistry://us-maven.pkg.dev/...
369+
-->
370+
<id>release-gcp-artifact-registry</id>
371+
<properties>
372+
<artifact-registry-url>artifactregistry://undefined-artifact-registry-url-value</artifact-registry-url>
373+
</properties>
374+
<distributionManagement>
375+
<repository>
376+
<id>gcp-artifact-registry-repository</id>
377+
<url>${artifact-registry-url}</url>
378+
</repository>
379+
<snapshotRepository>
380+
<id>gcp-artifact-registry-repository</id>
381+
<url>${artifact-registry-url}</url>
382+
</snapshotRepository>
383+
</distributionManagement>
384+
</profile>
354385
<profile>
355386
<id>linkage-check</id>
356387
<!-- Not running as part of normal build because 'install' task interferes this rule when

0 commit comments

Comments
 (0)