Skip to content

Commit

Permalink
ci: profile to upload to GCP Artifact Registry (#1132)
Browse files Browse the repository at this point in the history
* ci: profile to upload to GCP Artifact Registry

* A profile to avoid using nexus-staging-maven-plugin
  • Loading branch information
suztomo authored Dec 23, 2024
1 parent b57299e commit 8e6ce3a
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 16 deletions.
62 changes: 51 additions & 11 deletions google-oauth-client-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,6 @@
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
Expand Down Expand Up @@ -134,6 +123,57 @@
</build>

<profiles>
<!-- Because the BOM artifact does not need to inherit other properties such as dependencies
in the root pom.xml, this needs to define publication-related profiles. -->
<profile>
<!-- By default, we release artifacts to Sonatype, which requires
nexus-staging-maven-plugin. -->
<id>release-sonatype</id>
<activation>
<property>
<!-- Only when we use the release-gcp-artifact-registry profile,
which comes with artifact-registry-url property, this profile is
turned off. -->
<name>!artifact-registry-url</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://google.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- Optionally, we can publish the artifacts to GCP Artifact Registry specifying
this release-gcp-artifact-registry profile:
mvn deploy -P=release-gcp-artifact-registry -P=-release-sonatype \
-Dartifact-registry-url=artifactregistry://us-maven.pkg.dev/...
-->
<id>release-gcp-artifact-registry</id>
<properties>
<artifact-registry-url>artifactregistry://please-define-artifact-registry-url-property</artifact-registry-url>
</properties>
<distributionManagement>
<repository>
<id>gcp-artifact-registry-repository</id>
<url>${artifact-registry-url}</url>
</repository>
<snapshotRepository>
<id>gcp-artifact-registry-repository</id>
<url>${artifact-registry-url}</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>release-sign-artifacts</id>
<activation>
Expand Down
47 changes: 42 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
Expand Down Expand Up @@ -517,7 +513,6 @@
</plugins>
</build>
</profile>

<profile>
<id>docFX</id>
<activation>
Expand Down Expand Up @@ -578,5 +573,47 @@
</plugins>
</build>
</profile>
<profile>
<!-- By default, we release artifacts to Sonatype, which requires
nexus-staging-maven-plugin. -->
<id>release-sonatype</id>
<activation>
<property>
<!-- Only when we use the release-gcp-artifact-registry profile,
which comes with artifact-registry-url property, this profile is
turned off. -->
<name>!artifact-registry-url</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- Optionally, we can publish the artifacts to GCP Artifact Registry specifying
this release-gcp-artifact-registry profile:
mvn deploy -P=release-gcp-artifact-registry -P=-release-sonatype \
-Dartifact-registry-url=artifactregistry://us-maven.pkg.dev/...
-->
<id>release-gcp-artifact-registry</id>
<properties>
<artifact-registry-url>artifactregistry://please-define-artifact-registry-url-property</artifact-registry-url>
</properties>
<distributionManagement>
<repository>
<id>gcp-artifact-registry-repository</id>
<url>${artifact-registry-url}</url>
</repository>
<snapshotRepository>
<id>gcp-artifact-registry-repository</id>
<url>${artifact-registry-url}</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
</project>

0 comments on commit 8e6ce3a

Please sign in to comment.