Skip to content

Commit

Permalink
chore: sync.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
夏羊群 committed Dec 19, 2024
1 parent 154309d commit e5be149
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions scripts/publishCN/common.sh
Original file line number Diff line number Diff line change
@@ -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"
22 changes: 22 additions & 0 deletions scripts/publishCN/rewrite-dep.sh
Original file line number Diff line number Diff line change
@@ -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}
22 changes: 22 additions & 0 deletions scripts/publishCN/rewrite-example.sh
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit e5be149

Please sign in to comment.