Skip to content

Commit

Permalink
Fixed publishing to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
merlimat committed Jan 31, 2024
1 parent 958a54d commit f2b8760
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-maven-publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
name: test-results
path: test-results.zip
- name: Publish to the Maven Central Repository
run: mvn --batch-mode -Prelease -DskipTests deploy
run: mvn --batch-mode -s etc/settings.xml -Prelease -DskipTests deploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
39 changes: 39 additions & 0 deletions etc/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
Copyright © 2022-2024 StreamNative Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<settings>
<servers>
<server>
<id>central</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>

<profiles>
<profile>
<id>sonatype</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.keyname>${env.GPG_PRIVATE_KEY}</gpg.keyname>
<gpg.passphrase>${env.GPG_PRIVATE_KEY_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
38 changes: 12 additions & 26 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -448,32 +448,6 @@
<id>release</id>
<build>
<plugins>
<!-- calculate checksums of source release for Apache dist area -->
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.11</version>
<executions>
<execution>
<id>source-release-checksum</id>
<goals>
<goal>artifacts</goal>
</goals>
<phase>post-integration-test</phase>
<configuration>
<algorithms>
<algorithm>MD5</algorithm>
<algorithm>SHA-1</algorithm>
<algorithm>SHA-512</algorithm>
</algorithms>
<includeClassifiers>source-release</includeClassifiers>
<excludeMainArtifact>true</excludeMainArtifact>
<csvSummary>false</csvSummary>
<attachChecksums>true</attachChecksums>
</configuration>
</execution>
</executions>
</plugin>
<!-- We want to sign the artifact, the POM, and all attached artifacts (except for SHA-512 checksum) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -522,6 +496,18 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.3.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<tokenAuth>true</tokenAuth>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down

0 comments on commit f2b8760

Please sign in to comment.