From e5be1498d17ba6e9606b60e6e44ccfe4cc26ea3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E7=BE=8A=E7=BE=A4?= Date: Thu, 19 Dec 2024 16:26:13 +0800 Subject: [PATCH] chore: sync.yml --- .github/workflows/sync.yml | 23 +++++++++++++++++++++++ CMakeLists.txt | 4 ++-- scripts/publishCN/common.sh | 19 +++++++++++++++++++ scripts/publishCN/rewrite-dep.sh | 22 ++++++++++++++++++++++ scripts/publishCN/rewrite-example.sh | 22 ++++++++++++++++++++++ 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/sync.yml create mode 100644 scripts/publishCN/common.sh create mode 100644 scripts/publishCN/rewrite-dep.sh create mode 100644 scripts/publishCN/rewrite-example.sh diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 000000000..2e319da8d --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,23 @@ +name: Sync to shengwang + +on: + workflow_dispatch: + +jobs: + move-to-shengwang: + runs-on: ubuntu-latest + steps: + - name: Sync to shengwang + uses: AgoraIO-Extensions/actions/.github/actions/shengwang-sync@sync + with: + target-repo: 'Electron-SDK' + source-repo: 'Shengwang-Electron-SDK' + github-token: ${{ secrets.GH_TOKEN }} + target-branch: ${{ github.ref_name }} + github-email: ${{ secrets.GIT_EMAIL }} + github-private-key: ${{ secrets.GH_PRIVATE_KEY }} + github-username: ${{ secrets.GIT_USERNAME }} + pre-command: | + sh scripts/publishCN/rewrite-dep.sh + sh scripts/publishCN/rewrite-example.sh + create-pr: true diff --git a/CMakeLists.txt b/CMakeLists.txt index ccdafb507..e7e15b5e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,7 @@ file(GLOB TARGET_AGORA_NODE_EXT_FILE if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") set(AGORA_IRIS_PROJECT_ARCH "MAC") set(AGORA_RTC_SDK_PATH - ${CMAKE_CURRENT_SOURCE_DIR}/native/Agora_Native_SDK_for_Mac_FULL/libs + ${CMAKE_CURRENT_SOURCE_DIR}/native/*_Native_SDK_for_Mac_FULL/libs ) # native rtc sdk library set(AGORA_RTC_SDK_LIBRARY @@ -101,7 +101,7 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") ${CMAKE_CURRENT_SOURCE_DIR}/native) file(GLOB AGORA_RTC_SDK_LIBRARY - ${AGORA_RTC_SDK_PATH}/Agora_Native_SDK_for_Windows_FULL/sdk/${AGORA_RTC_PROJECT_ARCH}/*.dll + ${AGORA_RTC_SDK_PATH}/*_Native_SDK_for_Windows_FULL/sdk/${AGORA_RTC_PROJECT_ARCH}/*.dll ) # iris sdk path diff --git a/scripts/publishCN/common.sh b/scripts/publishCN/common.sh new file mode 100644 index 000000000..0f8daf1bb --- /dev/null +++ b/scripts/publishCN/common.sh @@ -0,0 +1,19 @@ +# common.sh +#!/bin/bash + +old_package_name='agora-electron-sdk' +new_package_name='shengwang-electron-sdk' + +#./package.json +old_name="\"name\": \"agora-electron-sdk\"" +new_name="\"name\": \"shengwang-electron-sdk\"" + +old_description="\"description\": \"agora-electron-sdk\"" +new_description="\"description\": \"shengwang-electron-sdk\"" + +old_yarn_link="yarn example link agora-electron-sdk" +new_yarn_link="yarn example link shengwang-electron-sdk" + +# node_modules +old_node_modules="node_modules/agora-electron-sdk" +new_node_modules="node_modules/shengwang-electron-sdk" diff --git a/scripts/publishCN/rewrite-dep.sh b/scripts/publishCN/rewrite-dep.sh new file mode 100644 index 000000000..d868d8660 --- /dev/null +++ b/scripts/publishCN/rewrite-dep.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e +MY_PATH=$(realpath $(dirname "$0")) +PROJECT_ROOT=$(realpath ${MY_PATH}/../..) +. ${PROJECT_ROOT}/scripts/publishCN/common.sh + +change_file=${PROJECT_ROOT}/package.json +sed "s/${old_name}/${new_name}/g" ${change_file} >tmp && mv tmp ${change_file} +sed "s/${old_description}/${new_description}/g" ${change_file} >tmp && mv tmp ${change_file} +sed "s/${old_yarn_link}/${new_yarn_link}/g" ${change_file} >tmp && mv tmp ${change_file} + +change_file=${PROJECT_ROOT}/tsconfig.json +sed "s/${old_package_name}/${new_package_name}/g" ${change_file} >tmp && mv tmp ${change_file} + +change_file=${PROJECT_ROOT}/.github/workflows/publish.yml +sed "s/${old_package_name}/${new_package_name}/g" ${change_file} >tmp && mv tmp ${change_file} + +change_file=${PROJECT_ROOT}/ci/packager-mac.sh +sed "s#${old_node_modules}#${new_node_modules}#g" ${change_file} >tmp && mv tmp ${change_file} + +change_file=${PROJECT_ROOT}/ci/packager-win.ps1 +sed "s#${old_node_modules}#${new_node_modules}#g" ${change_file} >tmp && mv tmp ${change_file} diff --git a/scripts/publishCN/rewrite-example.sh b/scripts/publishCN/rewrite-example.sh new file mode 100644 index 000000000..8eb17c2c8 --- /dev/null +++ b/scripts/publishCN/rewrite-example.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e +MY_PATH=$(realpath $(dirname "$0")) +PROJECT_ROOT=$(realpath ${MY_PATH}/../..) +. ${PROJECT_ROOT}/scripts/publishCN/common.sh + +change_dir="${PROJECT_ROOT}/example/src" + +find "$change_dir" -type f | while read -r file; do + sed -i.bak "s/${old_package_name}/${new_package_name}/g" "$file" + echo "Replaced in $file" +done + +change_file=${PROJECT_ROOT}/example/package.json +sed "s/${old_package_name}/${new_package_name}/g" ${change_file} >tmp && mv tmp ${change_file} + +change_file=${PROJECT_ROOT}/example/webpack.renderer.additions.js +sed "s/${old_package_name}/${new_package_name}/g" ${change_file} >tmp && mv tmp ${change_file} + +find "$change_dir" -name "*.bak" -type f -delete + +echo "All replacements completed successfully, and backup files have been deleted."