Skip to content

Commit

Permalink
[ci][*][*] add action to build and publish packages (#7)
Browse files Browse the repository at this point in the history
* [ci][*][*] add action to build and publish packages
  • Loading branch information
zouxyan authored Jun 14, 2023
1 parent d9b5bde commit 5c8207d
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
7 changes: 7 additions & 0 deletions antchain-bridge-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,11 @@
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/AntChainOpenLab/AntChainBridgePluginSDK</url>
</repository>
</distributionManagement>
</project>
8 changes: 7 additions & 1 deletion antchain-bridge-plugin-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,11 @@
</plugin>
</plugins>
</build>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/AntChainOpenLab/AntChainBridgePluginSDK</url>
</repository>
</distributionManagement>
</project>
7 changes: 7 additions & 0 deletions antchain-bridge-plugin-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,12 @@
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/AntChainOpenLab/AntChainBridgePluginSDK</url>
</repository>
</distributionManagement>

</project>
7 changes: 7 additions & 0 deletions antchain-bridge-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,12 @@
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/AntChainOpenLab/AntChainBridgePluginSDK</url>
</repository>
</distributionManagement>

</project>
45 changes: 45 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5c8207d

Please sign in to comment.