Skip to content

Commit

Permalink
Adds publish-maven-central (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrongestNumber9 authored Aug 7, 2024
1 parent 4107c8c commit ebe1dad
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,20 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Setup Maven Central
uses: actions/setup-java@v2
with:
java-version: 8.0.292+10
distribution: 'adopt'
server-id: central-sonatype-org
server-username: CENTRAL_SONATYPE_ORG_USERNAME
server-password: CENTRAL_SONATYPE_ORG_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Maven Central
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean deploy -Pbuild-nogenerate,publish-maven-central
env:
CENTRAL_SONATYPE_ORG_USERNAME: ${{ secrets.CENTRAL_SONATYPE_ORG_USERNAME }}
CENTRAL_SONATYPE_ORG_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_ORG_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
50 changes: 50 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,56 @@
<maven.compiler.release>8</maven.compiler.release>
</properties>
</profile>
<profile>
<id>publish-maven-central</id>
<distributionManagement>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central-sonatype-org</publishingServerId>
<tokenAuth>true</tokenAuth>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>publish-github-packages</id>
<build>
Expand Down

0 comments on commit ebe1dad

Please sign in to comment.