Skip to content

Commit

Permalink
Add support for maven central release
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemTetenkin committed Nov 6, 2024
1 parent 2e53563 commit a50f84e
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish_to_maven_central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: release and push to central
on:
push:
tags:
- '*'
jobs:
publish:
runs-on: ubuntu-latest
environment: publish
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 11
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: build artifact
run: mvn clean package -DskipTests
- name: Publish to the Maven Central Repository
run: |
mvn \
--no-transfer-progress \
--batch-mode \
deploy -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
96 changes: 96 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<version>2.3.3</version>
<packaging>pom</packaging>
<name>psc-java-oss</name>
<description>PubSub Client (PSC)</description>
<url>https://github.com/pinterest/psc</url>

<modules>
<module>psc</module>
<module>psc-examples</module>
Expand All @@ -28,6 +31,41 @@
<reflections.version>0.9.9</reflections.version>
</properties>

<developers>
<developer>
<id>vahid</id>
<name>Vahid Hashemian</name>
<organization>Pinterest Logging Platform</organization>
</developer>
<developer>
<id>jeff</id>
<name>Jeff Xiang</name>
<organization>Pinterest Logging Platform</organization>
</developer>
</developers>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<scm>
<connection>scm:git:git@pinterest/psc.git</connection>
<developerConnection>scm:git:[email protected]:pinterest/psc.git</developerConnection>
<url>https://github.com/pinterest/psc</url>
<tag>HEAD</tag>
</scm>

<distributionManagement>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -102,6 +140,64 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-source</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.7</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
Expand Down

0 comments on commit a50f84e

Please sign in to comment.