From c208aa2447a9e6805735e574a36f9b9fb51a3a60 Mon Sep 17 00:00:00 2001 From: Qiang Zhao Date: Sat, 11 Nov 2023 02:57:20 +0800 Subject: [PATCH] Publish jar to Maven Central --- .../workflows/ci-maven-publish-release.yaml | 53 +++++++ pom.xml | 142 +++++++++++++----- 2 files changed, 155 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/ci-maven-publish-release.yaml diff --git a/.github/workflows/ci-maven-publish-release.yaml b/.github/workflows/ci-maven-publish-release.yaml new file mode 100644 index 00000000..df530ba2 --- /dev/null +++ b/.github/workflows/ci-maven-publish-release.yaml @@ -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 }} diff --git a/pom.xml b/pom.xml index dad12d3f..2847f964 100644 --- a/pom.xml +++ b/pom.xml @@ -24,9 +24,10 @@ oxia-java 0.0.15-SNAPSHOT pom - Oxia Implementations for Java - - 2022 + Oxia Client SDK for Java + Oxia Client SDK for Java + http://github.com/streanative/oxia-java + 2023 StreamNative Inc. @@ -50,12 +51,23 @@ pulsar-metadatastore-oxia + + scm:git:git://github.com/streamnative/oxia-java.git + scm:git:ssh://github.com:streamnative/oxia-java.git + https://github.com/streamnative/oxia-java + + - github - GitHub Packages - https://maven.pkg.github.com/streamnative/oxia-java + ossrh + Central Repository OSSRH + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + ossrh + Snapshot Repository OSSRH + https://s01.oss.sonatype.org/content/repositories/snapshots + @@ -349,40 +361,6 @@ - - org.apache.maven.plugins - maven-javadoc-plugin - 3.6.3 - - none - true - - **/generated-sources/*.java - - - - - - javadoc - jar - - verify - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - - jar - - verify - - - maven-surefire-plugin ${maven.surefire.plugin.version} @@ -465,4 +443,88 @@ + + + release + + + + + net.nicoulaj.maven.plugins + checksum-maven-plugin + 1.11 + + + source-release-checksum + + artifacts + + post-integration-test + + + MD5 + SHA-1 + SHA-512 + + source-release + true + false + true + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.1.0 + + + sign-release-artifacts + + sign + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.6.3 + + none + true + + **/generated-sources/*.java + + + + + + javadoc + jar + + verify + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + + jar-no-fork + + verify + + + + + + + +