From 509b916c84454148fd7118077a3de7f78487c4fd Mon Sep 17 00:00:00 2001 From: Nicole00 Date: Thu, 9 Dec 2021 09:45:10 +0800 Subject: [PATCH] modify pom to support auto deploy workflow --- .github/workflows/deploy_release.yml | 56 ++++++++++++++++ .github/workflows/deploy_snapshot.yml | 58 +++++++++++++++++ pom.xml | 94 ++++++++++++++++++++++----- 3 files changed, 193 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/deploy_release.yml create mode 100644 .github/workflows/deploy_snapshot.yml diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml new file mode 100644 index 00000000..a2a415cb --- /dev/null +++ b/.github/workflows/deploy_release.yml @@ -0,0 +1,56 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Deploy Exchange release version to Maven Central Repository + +on: + release: + types: published + +jobs: + deploy: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Cache the Maven packages to speed up build + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: download neo4j-contrib & graphframes & pulsar-spark-connector dependency + run: | + wget https://oss-cdn.nebula-graph.com.cn/jar-packages/neo4j-contrib.zip + wget https://oss-cdn.nebula-graph.com.cn/jar-packages/graphframes.zip + wget https://oss-cdn.nebula-graph.com.cn/jar-packages/streamnative.zip + unzip -o -d ~/.m2/repository/ neo4j-contrib.zip + unzip -o -d ~/.m2/repository/ graphframes.zip + rm -rf ~/.m2/repository/io/streamnative + unzip -o -d ~/.m2/repository/io/ streamnative.zip + + - name: Install nebula-graph + run: | + mkdir tmp + pushd tmp + git clone https://github.com/vesoft-inc/nebula-docker-compose.git + pushd nebula-docker-compose/ + cp ../../nebula-exchange/src/test/resources/docker-compose.yaml . + docker-compose up -d + sleep 10 + popd + popd + + - name: Deploy release to Maven + uses: samuelmeuli/action-maven-publish@v1 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} + nexus_username: ${{ secrets.OSSRH_USERNAME }} + nexus_password: ${{ secrets.OSSRH_TOKEN }} diff --git a/.github/workflows/deploy_snapshot.yml b/.github/workflows/deploy_snapshot.yml new file mode 100644 index 00000000..5a11d843 --- /dev/null +++ b/.github/workflows/deploy_snapshot.yml @@ -0,0 +1,58 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Deploy Exchange SNAPSHOT version to Maven SNAPSHOT Repository + +on: + push: + branches: [ master ] + schedule: + - cron: '0 6 * * *' + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Cache the Maven packages to speed up build + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: download neo4j-contrib & graphframes & pulsar-spark-connector dependency + run: | + wget https://oss-cdn.nebula-graph.com.cn/jar-packages/neo4j-contrib.zip + wget https://oss-cdn.nebula-graph.com.cn/jar-packages/graphframes.zip + wget https://oss-cdn.nebula-graph.com.cn/jar-packages/streamnative.zip + unzip -o -d ~/.m2/repository/ neo4j-contrib.zip + unzip -o -d ~/.m2/repository/ graphframes.zip + rm -rf ~/.m2/repository/io/streamnative + unzip -o -d ~/.m2/repository/io/ streamnative.zip + + - name: Install nebula-graph + run: | + mkdir tmp + pushd tmp + git clone https://github.com/vesoft-inc/nebula-docker-compose.git + pushd nebula-docker-compose/ + cp ../../nebula-exchange/src/test/resources/docker-compose.yaml . + docker-compose up -d + sleep 10 + popd + popd + + - name: Deploy SNAPSHOT to Sonatype + uses: samuelmeuli/action-maven-publish@v1 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} + nexus_username: ${{ secrets.OSSRH_USERNAME }} + nexus_password: ${{ secrets.OSSRH_TOKEN }} diff --git a/pom.xml b/pom.xml index 92ddb270..1c9d080e 100644 --- a/pom.xml +++ b/pom.xml @@ -50,29 +50,93 @@ - release - https://oss.sonatype.org/service/local/staging/deploy/maven2/ + ossrh + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2 - snapshots - https://oss.sonatype.org/content/repositories/snapshots/ + ossrh + Nexus Snapshot Repository + https://oss.sonatype.org/content/repositories/snapshots + + + + deploy + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.0 + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + attach-javadocs + + jar + + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + --pinentry-mode + loopback + + + + + + + + + + + + - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - verify - - sign - - - + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false +