Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish jar to Maven Central #120

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci-maven-publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI - Maven Publish Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
# Publish nightly builds
schedule:
- cron: '0 0 * * *' # run at midnight UTC
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Verify
run: mvn --no-transfer-progress --batch-mode verify
- name: Package surefire test results
if: failure()
run: |
rm -rf test-results
mkdir test-results
find . -type d -name "*surefire*" -exec cp --parents -R {} test-results/ \;
zip -r test-results.zip test-results
- name: Upload test results
uses: actions/upload-artifact@v3
if: failure()
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 }}
142 changes: 102 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
<artifactId>oxia-java</artifactId>
<version>0.0.15-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Oxia Implementations for Java</name>

<inceptionYear>2022</inceptionYear>
<name>Oxia Client SDK for Java</name>
<description>Oxia Client SDK for Java</description>
<url>http://github.com/streanative/oxia-java</url>
<inceptionYear>2023</inceptionYear>

<organization>
<name>StreamNative Inc.</name>
Expand All @@ -50,12 +51,23 @@
<module>pulsar-metadatastore-oxia</module>
</modules>

<scm>
<connection>scm:git:git://github.com/streamnative/oxia-java.git</connection>
<developerConnection>scm:git:ssh://github.com:streamnative/oxia-java.git</developerConnection>
<url>https://github.com/streamnative/oxia-java</url>
</scm>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/streamnative/oxia-java</url>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<name>Snapshot Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<properties>
Expand Down Expand Up @@ -349,40 +361,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<doclint>none</doclint>
<notimestamp>true</notimestamp>
<sourceFileExcludes>
<sourceFileExclude>**/generated-sources/*.java</sourceFileExclude>
</sourceFileExcludes>
</configuration>
<executions>
<execution>
<goals>
<goal>javadoc</goal>
<goal>jar</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
Expand Down Expand Up @@ -465,4 +443,88 @@
</plugins>
</build>

<profiles>
<profile>
<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>
<executions>
<execution>
<id>sign-release-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<doclint>none</doclint>
<notimestamp>true</notimestamp>
<sourceFileExcludes>
<sourceFileExclude>**/generated-sources/*.java</sourceFileExclude>
</sourceFileExcludes>
</configuration>
<executions>
<execution>
<goals>
<goal>javadoc</goal>
<goal>jar</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>jar-no-fork</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Loading