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 1fbe7ad
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/ci-maven-publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ jobs:
with:
name: test-results
path: test-results.zip
- name: Publish to the Maven Central Repository
run: mvn --batch-mode -Prelease -DskipTests deploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

- name: Release Maven package
uses: samuelmeuli/action-maven-publish@v1
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
nexus_username: ${{ secrets.SONATYPE_USERNAME }}
nexus_password: ${{ secrets.SONATYPE_PASSWORD }}
server_id: ossrh
maven_profiles: release
maven_goals_phases: clean deploy
maven_args: -DskipTests
49 changes: 20 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -448,43 +448,24 @@
<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>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<!-- Prevent `gpg` from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
<id>sign-release-artifacts</id>
<id>sign-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -522,9 +503,19 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit 1fbe7ad

Please sign in to comment.