Skip to content

Commit

Permalink
ci: update arch-convert script
Browse files Browse the repository at this point in the history
  • Loading branch information
mym0404 committed Apr 24, 2024
1 parent 5f3ad5e commit 9094e64
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
8 changes: 0 additions & 8 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,3 @@ runs:
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
shell: bash

- name: Install ClangFormat
shell: bash
run: brew install clang-format

- name: Install Ktlint
shell: bash
run: brew install ktlint
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ jobs:
- name: Setup
uses: ./.github/actions/setup

- name: Install ClangFormat
shell: bash
run: brew install clang-format

- name: Install Ktlint
shell: bash
run: brew install ktlint

- name: Generate Example Project
run: yarn new

Expand Down
26 changes: 23 additions & 3 deletions script/arch-convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,27 @@ NEW_VALUE="$1"
POD="$2"
CLEAN="$3"

# Modify app.json
JSON="example/app.json"
sed -i '' -e "s/\"newArchEnabled\": true/\"newArchEnabled\": ${NEW_VALUE}/g" $JSON
sed -i '' -e "s/\"newArchEnabled\": false/\"newArchEnabled\": ${NEW_VALUE}/g" $JSON

# Validate new value is either "true" or "false"
if [ "${NEW_VALUE}" != "true" ] && [ "${NEW_VALUE}" != "false" ]; then
echo "Error: The argument should be either 'true' or 'false'"
exit 1
fi

if [ ! -d "example/android" ]; then
ANDROID_GEN=1
yarn gen:android
fi
if [ ! -d "example/ios" ]; then
IOS_GEN=1
yarn gen:ios
fi


# Gradle properties file
FILE="example/android/gradle.properties"

Expand All @@ -23,16 +38,21 @@ FILE="example/android/gradle.properties"
# Use 'sed' to replace the property value
sed -i '' -e "s/${PROPERTY}=.*/${PROPERTY}=${NEW_VALUE}/" ${FILE}

JSON="example/app.json"
sed -i '' -e "s/\"newArchEnabled\": true/\"newArchEnabled\": ${NEW_VALUE}/g" $JSON
sed -i '' -e "s/\"newArchEnabled\": false/\"newArchEnabled\": ${NEW_VALUE}/g" $JSON




if [[ $CLEAN == 'true' ]]; then
yarn gen:android:clean
yarn gen:ios:clean
else

if [[ $ANDROID_GEN != '1' ]]; then
yarn gen:android
fi
if [[ $IOS != '1' ]]; then
yarn gen:ios
fi

if [[ $POD == 'true' ]]; then
if [[ $NEW_VALUE == 'true' ]]; then
Expand Down

0 comments on commit 9094e64

Please sign in to comment.