Koupleless Runtime Release #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Koupleless Runtime Release | |
## https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release | |
## trigger manually | |
on: | |
workflow_dispatch: | |
jobs: | |
# build_and_test: | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# - uses: actions/checkout@v3 | |
# | |
# - name: Set up JDK 8 | |
# uses: actions/setup-java@v3 | |
# with: | |
# java-version: '8' | |
# distribution: 'temurin' | |
# cache: maven | |
# | |
# - name: Update Maven version to 3.9.x to enable cross bundle without install | |
# env: | |
# MAVEN_VERSION: '3.9.5' | |
# run: | | |
# wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz | |
# tar xzvf apache-maven-${MAVEN_VERSION}-bin.tar.gz | |
# echo "MAVEN_HOME=$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}" >> $GITHUB_ENV | |
# echo "$GITHUB_WORKSPACE/apache-maven-${MAVEN_VERSION}/bin" >> $GITHUB_PATH | |
# | |
# - name: Build with Maven | |
# run: mvn clean install -DskipTests -B -U -e && sh ./check_format.sh | |
# | |
# - name: Set up Docker | |
# uses: docker/metadata-action@v3 | |
# with: | |
# images: | | |
# node:14 | |
# | |
# - name: Checkout sampletest Repository | |
# uses: actions/checkout@v3 | |
# with: | |
# repository: 'koupleless/samples' | |
# path: 'samples' | |
# | |
# - name: Checkout adapter Repository | |
# uses: actions/checkout@v3 | |
# with: | |
# repository: 'koupleless/adapter' | |
# path: 'adapter' | |
# | |
# - name: Build adapter and install | |
# run: cd adapter && ./script/ci_build.sh 1.8 install | |
# | |
# - name: get koupleless-runtime version & update koupleless-runtime version for all test sample app | |
# run: | | |
# koupleless_runtime_version=$(find ./koupleless-common -name "*.jar" |grep -v source |sed "s/.*koupleless-common-\(.*\).jar/\1/") | |
# echo "升级 koupleless-runtime version to $koupleless_runtime_version" | |
# for testsample in `find samples -name "*[^3|^dubbo|^dubbo32]-samples"`;do sed -i "s/<koupleless.runtime.version>.*<\/koupleless.runtime.version>/<koupleless.runtime.version>$koupleless_runtime_version<\/koupleless.runtime.version>/g" $testsample/pom.xml ;done | |
# for testsample in `find samples -name "*[^3|^dubbo|^dubbo32]-samples"`;do if cat $testsample/pom.xml |grep "<koupleless.runtime.version>"|grep $koupleless_runtime_version;then echo "版本校验通过";else echo "版本校验失败";exit 1;fi;done | |
# | |
# - name: Test Env prepare | |
# run: | | |
# sudo apt-get update >>/tmp/envprepare.out | |
# sudo apt-get install -y expect >>/tmp/envprepare.out | |
# docker pull mongo:7.0.2-jammy | |
# docker run --name mongodb -d -p 27017:27017 -v /home/runner/work/data:/data/db mongo:7.0.2-jammy | |
# docker pull zookeeper:3.9.0 | |
# docker run -p 2181:2181 -it --name zookeeper --restart always -d zookeeper:3.9.0 | |
# docker pull apache/rocketmq:4.9.7 | |
# docker run -d -p 9876:9876 -p 10909:10909 -p 10910:10910 -p 10911:10911 -p 10912:10912 -v $(pwd)/samples/springboot-samples/msg/rocketmq/config/start.sh:/home/rocketmq/rocketmq-4.9.7/bin/start.sh -v $(pwd)/samples/springboot-samples/msg/rocketmq/config/broker.conf:/home/rocketmq/rocketmq-4.9.7/bin/broker.conf apache/rocketmq:4.9.7 sh /home/rocketmq/rocketmq-4.9.7/bin/start.sh | |
# docker run -d -p 9092:9092 -p 9093:9093 --name kafka-3.6.2 -e KAFKA_ENABLE_KRAFT=yes -e KAFKA_CFG_NODE_ID=1 -e KAFKA_CFG_PROCESS_ROLES=controller,broker -e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 -e KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT -e KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@localhost:9093 -e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER -e KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true -e KAFKA_BROKER_ID=1 bitnami/kafka:3.6.2 | |
# sudo apt-get install redis-server -y | |
# sudo systemctl start redis-server | |
# docker-compose -f samples/springboot-samples/config/apollo/config/docker-compose.yml up -d | |
# sudo cp .github/workflows/ccbin/arkctl /usr/bin/arkctl | |
# sudo chmod +x /usr/bin/arkctl | |
# | |
# - name: Run jdk8 koupleless runtime test | |
# run: | | |
# set -e | |
# bash -x .github/workflows/ccbin/start.sh jdk8 | |
release_for_jdk8: | |
# needs: build_and_test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
cache: maven | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase | |
- name: install with Maven | |
run: mvn clean install | |
- name: deploy with Maven | |
run: mvn --batch-mode deploy -DskipTests -Prelease | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: checkout adapter repo | |
uses: actions/checkout@v3 | |
with: | |
repository: 'koupleless/adapter' | |
path: 'adapter' | |
- name: Finding Maven Modules | |
id: find-maven-modules | |
run: | | |
echo "Finding Maven Modules" | |
# 定位 pom.xml 文件,通过 grep 排除掉根目录下的 pom.xml | |
modules=$(find . -name pom.xml -maxdepth 2 -not -path "./pom.xml" -exec dirname {} \;) | |
echo "$modules" | |
# 使用 jq 将 shell 数组转换成 JSON 数组供后续步骤使用 | |
modules_in_json=$(echo $modules | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
echo "$modules_in_json" | |
echo "modules-list=$modules_in_json" >> $GITHUB_OUTPUT | |
working-directory: adapter/ | |
- name: release adapter for jdk8 | |
run: | | |
# 创建一个映射来存储模块名到 JDK 版本的映射 | |
modules=(${{ join(fromJSON(steps.find-maven-modules.outputs.modules-list), ' ') }}) | |
modules_in_right_jdk="" | |
for module in "${modules[@]}"; do | |
# 读取模块中的 pom.xml 来确定 JDK 版本 | |
jdk_version=$(grep -m 1 '<java.version>' $module/pom.xml | sed 's/<[^>]*>//g' | xargs) | |
echo "${module} JDK version: ${jdk_version}" | |
# 如果是目标 jdk 版本,则执行 release 操作 | |
if [[ "${jdk_version}" == "1.8" ]]; then | |
modules_in_right_jdk="${modules_in_right_jdk}${module}," | |
fi | |
done | |
if [[ -n ${modules_in_right_jdk} ]]; then | |
modules_in_right_jdk="${modules_in_right_jdk:0:-1}" | |
echo "release for module ${modules_in_right_jdk}" | |
mvn --batch-mode deploy -Prelease -pl ${modules_in_right_jdk} -am -amd -B -U | |
echo "release completed for module ${modules_in_right_jdk}" | |
fi | |
working-directory: adapter/ | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |