Skip to content

Commit

Permalink
Add mvn central publish to 4.0 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffxiang committed Jan 30, 2025
1 parent c03e0d9 commit f011a32
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/core-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B install --file pom.xml
run: mvn -B install --file pom.xml -Dgpg.skip
4 changes: 2 additions & 2 deletions .github/workflows/it-case-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B install --file pom.xml -DskipTests
run: mvn -B install --file pom.xml -DskipTests -Dgpg.skip
- name: Run psc-flink *ITCase tests
run: mvn clean test -pl psc-flink -Dtest=*ITCase
run: mvn clean test -pl psc-flink -Dtest=*ITCase -Dgpg.skip
34 changes: 34 additions & 0 deletions .github/workflows/publish_to_maven_central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release and push to central
on:
push:
tags:
- '*'
jobs:
publish:
runs-on: ubuntu-latest
environment: publish
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v1
with:
java-version: 8
distribution: 'corretto'
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 }}
92 changes: 92 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.pinterest.psc</groupId>
<artifactId>psc-java-oss</artifactId>
<description>PubSub Client (PSC)</description>
<url>https://github.com/pinterest/psc</url>
<version>4.0.0</version>
<packaging>pom</packaging>
<name>psc-java-oss</name>
Expand All @@ -30,6 +32,38 @@
<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://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -104,6 +138,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 f011a32

Please sign in to comment.