diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 00000000..fd1f2f1b --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,34 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path + +name: Maven Package + +on: + release: + types: [created] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Build with Maven + run: scripts/package.sh + + - name: Publish to GitHub Packages Apache Maven + run: scripts/deploy.sh + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/antchain-bridge-commons/pom.xml b/antchain-bridge-commons/pom.xml index 2ade481e..424d755d 100644 --- a/antchain-bridge-commons/pom.xml +++ b/antchain-bridge-commons/pom.xml @@ -97,4 +97,11 @@ + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/AntChainOpenLab/AntChainBridgePluginSDK + + \ No newline at end of file diff --git a/antchain-bridge-plugin-lib/pom.xml b/antchain-bridge-plugin-lib/pom.xml index 3a7d36e3..9c7de589 100644 --- a/antchain-bridge-plugin-lib/pom.xml +++ b/antchain-bridge-plugin-lib/pom.xml @@ -53,5 +53,11 @@ - + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/AntChainOpenLab/AntChainBridgePluginSDK + + \ No newline at end of file diff --git a/antchain-bridge-plugin-manager/pom.xml b/antchain-bridge-plugin-manager/pom.xml index 2a2b9172..be680977 100644 --- a/antchain-bridge-plugin-manager/pom.xml +++ b/antchain-bridge-plugin-manager/pom.xml @@ -53,5 +53,12 @@ + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/AntChainOpenLab/AntChainBridgePluginSDK + + \ No newline at end of file diff --git a/antchain-bridge-spi/pom.xml b/antchain-bridge-spi/pom.xml index cb07d245..0c06db4a 100644 --- a/antchain-bridge-spi/pom.xml +++ b/antchain-bridge-spi/pom.xml @@ -32,5 +32,12 @@ test + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/AntChainOpenLab/AntChainBridgePluginSDK + + \ No newline at end of file diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 00000000..2c9a0cad --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +CURR_DIR="$(cd `dirname $0`; pwd)" +source ${CURR_DIR}/print.sh + +print_title + +cd ${CURR_DIR}/../antchain-bridge-commons +mvn deploy -s $GITHUB_WORKSPACE/settings.xml +if [ $? -ne 0 ]; then + log_error "failed to deploy antchain-bridge-commons" + exit 1 +fi +log_info "deploy antchain-bridge-commons successfully" +cd - > /dev/null 2>&1 + +cd ${CURR_DIR}/../antchain-bridge-spi +mvn deploy -s $GITHUB_WORKSPACE/settings.xml +if [ $? -ne 0 ]; then + log_error "failed to deploy antchain-bridge-spi" + exit 1 +fi +log_info "deploy antchain-bridge-spi successfully" +cd - > /dev/null 2>&1 + +cd ${CURR_DIR}/../antchain-bridge-plugin-lib +mvn deploy -s $GITHUB_WORKSPACE/settings.xml +if [ $? -ne 0 ]; then + log_error "failed to deploy antchain-bridge-plugin-lib" + exit 1 +fi +log_info "deploy antchain-bridge-plugin-lib successfully" +cd - > /dev/null 2>&1 + +cd ${CURR_DIR}/../antchain-bridge-plugin-manager +mvn deploy -s $GITHUB_WORKSPACE/settings.xml +if [ $? -ne 0 ]; then + log_error "failed to deploy antchain-bridge-plugin-manager" + exit 1 +fi +log_info "deploy antchain-bridge-plugin-manager successfully" +cd - > /dev/null 2>&1 + +log_info "success" +rm -rf antchain-bridge-sdk \ No newline at end of file