77 platform :
88 description : whether we want to build for iOS or Android
99 required : true
10+ retry-count :
11+ description : Number of retry attempts for failed operations
12+ required : false
13+ default : ' 3'
1014runs :
1115 using : composite
1216 steps :
@@ -15,29 +19,49 @@ runs:
1519 run : |
1620 cd /tmp
1721 npx @react-native-community/cli init RNApp --skip-install --version nightly
18- - name : Add library
19- shell : bash
20- run : |
21- cd /tmp/RNApp
22- yarn add ${{ inputs.library-npm-package }}
22+ - name : Add library with retry
23+ uses : nick-fields/retry@v3
24+ with :
25+ timeout_minutes : 10
26+ max_attempts : ${{ inputs.retry-count }}
27+ retry_wait_seconds : 15
28+ shell : bash
29+ command : |
30+ cd /tmp/RNApp
31+ yarn add ${{ inputs.library-npm-package }}
32+ on_retry_command : |
33+ echo "Cleaning up for yarn retry..."
34+ cd /tmp/RNApp
35+ rm -rf node_modules yarn.lock || true
36+ yarn cache clean || true
2337
2438 # iOS
2539 - name : Setup xcode
2640 if : ${{ inputs.platform == 'ios' }}
2741 uses : maxim-lobanov/setup-xcode@v1
2842 with :
2943 xcode-version : 16.4.0
30- - name : Build iOS
31- shell : bash
44+ - name : Build iOS with retry
3245 if : ${{ inputs.platform == 'ios' }}
33- run : |
34- cd /tmp/RNApp/ios
35- bundle install
36- RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 bundle exec pod install
37- xcodebuild build \
38- -workspace RNApp.xcworkspace \
39- -scheme RNApp \
40- -sdk iphonesimulator
46+ uses : nick-fields/retry@v3
47+ with :
48+ timeout_minutes : 30
49+ max_attempts : ${{ inputs.retry-count }}
50+ retry_wait_seconds : 30
51+ shell : bash
52+ command : |
53+ cd /tmp/RNApp/ios
54+ bundle install
55+ RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 bundle exec pod install
56+ xcodebuild build \
57+ -workspace RNApp.xcworkspace \
58+ -scheme RNApp \
59+ -sdk iphonesimulator
60+ on_retry_command : |
61+ echo "Cleaning up for iOS retry..."
62+ cd /tmp/RNApp/ios
63+ rm -rf Pods Podfile.lock build
64+ rm -rf ~/Library/Developer/Xcode/DerivedData/* || true
4165
4266 # Android
4367 - name : Setup Java for Android
4670 with :
4771 java-version : ' 17'
4872 distribution : ' zulu'
49- - name : Build Android
50- shell : bash
73+ - name : Build Android with retry
5174 if : ${{ inputs.platform == 'android' }}
52- run : |
53- cd /tmp/RNApp/android
54- ./gradlew assembleDebug
75+ uses : nick-fields/retry@v3
76+ with :
77+ timeout_minutes : 30
78+ max_attempts : ${{ inputs.retry-count }}
79+ retry_wait_seconds : 30
80+ shell : bash
81+ command : |
82+ cd /tmp/RNApp/android
83+ ./gradlew assembleDebug
84+ on_retry_command : |
85+ echo "Cleaning up for Android retry..."
86+ cd /tmp/RNApp/android
87+ ./gradlew clean || true
88+ rm -rf build app/build .gradle || true
0 commit comments