diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 00000000..89a50f95 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,16 @@ +name: Sync to shengwang + +on: + workflow_dispatch: + +jobs: + generate-codes: + runs-on: ubuntu-latest + steps: + - name: Generate code and comment by terra + uses: AgoraIO-Extensions/actions/.github/actions/shengwang@sync + with: + target_repo: 'git@github.com:AgoraIO-Extensions/react-native-shengwang.git' + target_branch: ${{ github.ref_name }} + pre-command: | + sh scripts/publishCN/rewrite.sh diff --git a/scripts/publishCN/rewrite.sh b/scripts/publishCN/rewrite.sh new file mode 100644 index 00000000..2e308e02 --- /dev/null +++ b/scripts/publishCN/rewrite.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e +MY_PATH=$(realpath $(dirname "$0")) +PROJECT_ROOT=$(realpath ${MY_PATH}/../..) + +old_package_name='react-native-agora' +new_package_name='react-native-shenwang' + +old_native_sdk_android_rtc='io.agora.rtc:full-sdk' +new_native_sdk_android_rtc='io.shengwang.rtc:full-sdk' +old_native_sdk_android_rtc_special='io.agora.rtc:agora-special-full' +new_native_sdk_android_rtc_special='io.shengwang.rtc:agora-special-full' +old_native_sdk_android_rtc_screen='io.agora.rtc:full-screen-sharing' +new_native_sdk_android_rtc_screen='io.shengwangw.rtc:full-screen-sharing' + +old_native_sdk_iOS_rtc='AgoraRtcEngine_iOS' +new_native_sdk_iOS_rtc='AgoraRtcEngine_iOS' +old_native_sdk_iOS_rtc_special='AgoraRtcEngine_Special_iOS' +new_native_sdk_iOS_rtc_special='ShengwangRtcEngine_Special_iOS' + +change_file=${PROJECT_ROOT}/react-native-agora.podspec +sed "s/${old_package_name}/${new_package_name}/g" ${change_file} > tmp && mv tmp ${change_file} +sed "s/${old_native_sdk_iOS_rtc}/${new_native_sdk_iOS_rtc}/g" ${change_file} > tmp && mv tmp ${change_file} +sed "s/${old_native_sdk_iOS_rtc_special}/${new_native_sdk_iOS_rtc_special}/g" ${change_file} > tmp && mv tmp ${change_file} +echo "${change_file} rewritten successfully" + +change_file=${PROJECT_ROOT}/android/build.gradle +sed "s/${old_native_sdk_android_rtc}/${new_native_sdk_android_rtc}/g" ${change_file} > tmp && mv tmp ${change_file} +sed "s/${old_native_sdk_android_rtc_special}/${new_native_sdk_android_rtc_special}/g" ${change_file} > tmp && mv tmp ${change_file} +sed "s/${old_native_sdk_android_rtc_screen}/${new_native_sdk_android_rtc_screen}/g" ${change_file} > tmp && mv tmp ${change_file} +echo "${change_file} rewritten successfully" + +change_file=${PROJECT_ROOT}/package.json +sed "s/${old_package_name}/${new_package_name}/g" ${change_file} > tmp && mv tmp ${change_file} +echo "${change_file} rewritten successfully" +