Skip to content

Commit

Permalink
[ci][code-gen.yaml] Support modify version in tool/terra/terra_config…
Browse files Browse the repository at this point in the history
…_main.yaml (#1818)
  • Loading branch information
littleGnAl committed Jun 12, 2024
1 parent 5716b55 commit 36906d8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
channel: 'stable'
- name: Run code-gen
run: |
bash scripts/code_gen.sh
bash scripts/code_gen.sh ${{ inputs.version }}
- name: Get current date
id: date
Expand Down
4 changes: 2 additions & 2 deletions scripts/code_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
set -e
set -x

TERRA_PATH=$1
RTC_VERSION=$1
MY_PATH=$(realpath $(dirname "$0"))
PROJECT_ROOT=$(realpath ${MY_PATH}/..)

pushd ${PROJECT_ROOT}

flutter packages get
bash ${PROJECT_ROOT}/tool/terra/build.sh ${TERRA_PATH}
bash ${PROJECT_ROOT}/tool/terra/build.sh ${RTC_VERSION}
bash ${MY_PATH}/flutter-build-runner.sh
bash ${PROJECT_ROOT}/tool/testcase_gen/build.sh

Expand Down
27 changes: 25 additions & 2 deletions tool/terra/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,36 @@
set -e
set -x

NEW_VERSION=$1
MY_PATH=$(realpath $(dirname "$0"))
PROJECT_ROOT=$(realpath ${MY_PATH}/../..)

TERRA_MAIN_FILE=${PROJECT_ROOT}/tool/terra/terra_config_main.yaml

if [ -n "$NEW_VERSION" ]; then
# Check the operating system type
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed -i '' -E "s/rtc_[0-9]+\.[0-9]+\.[0-9]+/${NEW_VERSION}/g" $TERRA_MAIN_FILE
else
# Linux and other Unix-like systems
sed -i -E "s/rtc_[0-9]+\.[0-9]+\.[0-9]+/${NEW_VERSION}/g" $TERRA_MAIN_FILE
fi
echo "Updated version to ${NEW_VERSION} in $TERRA_MAIN_FILE"
fi

bash ${MY_PATH}/prepare.sh

pushd ${MY_PATH}

npm exec terra -- run \
--config ${PROJECT_ROOT}/tool/terra/terra_config_main.yaml \
--output-dir=${PROJECT_ROOT}/lib/src
--config ${TERRA_MAIN_FILE} \
--output-dir=${PROJECT_ROOT}

popd

pushd ${PROJECT_ROOT}

dart format .

popd

0 comments on commit 36906d8

Please sign in to comment.