10
10
outputs :
11
11
www_branch_count : ${{ steps.check_branches.outputs.www_branch_count }}
12
12
fbsource_branch_count : ${{ steps.check_branches.outputs.fbsource_branch_count }}
13
+ last_version_classic : ${{ steps.get_last_version_www.outputs.last_version_classic }}
14
+ last_version_modern : ${{ steps.get_last_version_www.outputs.last_version_modern }}
15
+ last_version_rn : ${{ steps.get_last_version_rn.outputs.last_version_rn }}
16
+ current_version_classic : ${{ steps.get_current_version.outputs.current_version_classic }}
17
+ current_version_modern : ${{ steps.get_current_version.outputs.current_version_modern }}
18
+ current_version_rn : ${{ steps.get_current_version.outputs.current_version_rn }}
13
19
steps :
20
+ - uses : actions/checkout@v4
21
+ with :
22
+ ref : builds/facebook-www
23
+ - name : " Get last version string for www"
24
+ id : get_last_version_www
25
+ run : |
26
+ # Empty checks only needed for backwards compatibility,can remove later.
27
+ VERSION_CLASSIC=$( [ -f ./compiled/facebook-www/VERSION_CLASSIC ] && cat ./compiled/facebook-www/VERSION_CLASSIC || echo '' )
28
+ VERSION_MODERN=$( [ -f ./compiled/facebook-www/VERSION_MODERN ] && cat ./compiled/facebook-www/VERSION_MODERN || echo '' )
29
+ echo "Last classic version is $VERSION_CLASSIC"
30
+ echo "Last modern version is $VERSION_MODERN"
31
+ echo "last_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT"
32
+ echo "last_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT"
33
+ - uses : actions/checkout@v4
34
+ with :
35
+ ref : builds/facebook-fbsource
36
+ - name : " Get last version string for rn"
37
+ id : get_last_version_rn
38
+ run : |
39
+ # Empty checks only needed for backwards compatibility,can remove later.
40
+ VERSION_NATIVE_FB=$( [ -f ./compiled-rn/VERSION_NATIVE_FB ] && cat ./compiled-rn/VERSION_NATIVE_FB || echo '' )
41
+ echo "Last rn version is $VERSION_NATIVE_FB"
42
+ echo "last_version_rn=$VERSION_NATIVE_FB" >> "$GITHUB_OUTPUT"
14
43
- uses : actions/checkout@v4
15
44
- name : " Check branches"
16
45
id : check_branches
@@ -147,7 +176,7 @@ jobs:
147
176
mkdir -p ${BASE_FOLDER}/react-native-github/Libraries/Renderer/
148
177
mkdir -p ${BASE_FOLDER}/RKJSModules/vendor/react/{scheduler,react,react-is,react-test-renderer}/
149
178
150
- # Move React Native renderer
179
+ # Move React Native renderer
151
180
mv build/react-native/implementations/ $BASE_FOLDER/react-native-github/Libraries/Renderer/
152
181
mv build/react-native/shims/ $BASE_FOLDER/react-native-github/Libraries/Renderer/
153
182
mv build/facebook-react-native/scheduler/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/scheduler/
@@ -160,11 +189,27 @@ jobs:
160
189
rm $RENDERER_FOLDER/ReactFabric-{dev,prod,profiling}.js
161
190
rm $RENDERER_FOLDER/ReactNativeRenderer-{dev,prod,profiling}.js
162
191
163
- ls -R ./compiled
164
- - name : Add REVISION file
192
+ # Move React Native version file
193
+ mv build/facebook-react-native/VERSION_NATIVE_FB ./compiled-rn/VERSION_NATIVE_FB
194
+
195
+ ls -R ./compiled-rn
196
+ - name : Add REVISION files
165
197
run : |
166
198
echo ${{ github.sha }} >> ./compiled/facebook-www/REVISION
199
+ cp ./compiled/facebook-www/REVISION ./compiled/facebook-www/REVISION_TRANSFORMS
167
200
echo ${{ github.sha }} >> ./compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION
201
+ - name : " Get current version string"
202
+ id : get_current_version
203
+ run : |
204
+ VERSION_CLASSIC=$(cat ./compiled/facebook-www/VERSION_CLASSIC)
205
+ VERSION_MODERN=$(cat ./compiled/facebook-www/VERSION_MODERN)
206
+ VERSION_NATIVE_FB=$(cat ./compiled-rn/VERSION_NATIVE_FB)
207
+ echo "Current classic version is $VERSION_CLASSIC"
208
+ echo "Current modern version is $VERSION_MODERN"
209
+ echo "Current rn version is $VERSION_NATIVE_FB"
210
+ echo "current_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT"
211
+ echo "current_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT"
212
+ echo "current_version_rn=$VERSION_NATIVE_FB" >> "$GITHUB_OUTPUT"
168
213
- uses : actions/upload-artifact@v3
169
214
with :
170
215
name : compiled
@@ -188,15 +233,58 @@ jobs:
188
233
with :
189
234
name : compiled
190
235
path : compiled/
191
- - run : git status -u
236
+ - name : Revert version changes
237
+ if : needs.download_artifacts.outputs.last_version_classic != '' && needs.download_artifacts.outputs.last_version_modern != ''
238
+ env :
239
+ CURRENT_VERSION_CLASSIC : ${{ needs.download_artifacts.outputs.current_version_classic }}
240
+ CURRENT_VERSION_MODERN : ${{ needs.download_artifacts.outputs.current_version_modern }}
241
+ LAST_VERSION_CLASSIC : ${{ needs.download_artifacts.outputs.last_version_classic }}
242
+ LAST_VERSION_MODERN : ${{ needs.download_artifacts.outputs.last_version_modern }}
243
+ run : |
244
+ echo "Reverting $CURRENT_VERSION_CLASSIC to $LAST_VERSION_CLASSIC"
245
+ grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled || echo "No files found with $CURRENT_VERSION_CLASSIC"
246
+ grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled | xargs -r sed -i -e "s/$CURRENT_VERSION_CLASSIC/$LAST_VERSION_CLASSIC/g"
247
+ grep -rl "$CURRENT_VERSION_CLASSIC" ./compiled || echo "Classic version reverted"
248
+ echo "===================="
249
+ echo "Reverting $CURRENT_VERSION_MODERN to $LAST_VERSION_MODERN"
250
+ grep -rl "$CURRENT_VERSION_MODERN" ./compiled || echo "No files found with $CURRENT_VERSION_MODERN"
251
+ grep -rl "$CURRENT_VERSION_MODERN" ./compiled | xargs -r sed -i -e "s/$CURRENT_VERSION_MODERN/$LAST_VERSION_MODERN/g"
252
+ grep -rl "$CURRENT_VERSION_MODERN" ./compiled || echo "Modern version reverted"
192
253
- name : Check if only the REVISION file has changed
193
254
id : check_should_commit
194
255
run : |
195
- if git status --porcelain | grep -qv '/REVISION$'; then
256
+ echo "Full git status"
257
+ git status
258
+ echo "===================="
259
+ if git status --porcelain | grep -qv '/REVISION'; then
260
+ echo "Changes detected"
196
261
echo "should_commit=true" >> "$GITHUB_OUTPUT"
197
262
else
263
+ echo "No Changes detected"
198
264
echo "should_commit=false" >> "$GITHUB_OUTPUT"
199
265
fi
266
+ - name : Re-apply version changes
267
+ if : steps.check_should_commit.outputs.should_commit == 'true' && needs.download_artifacts.outputs.last_version_classic != '' && needs.download_artifacts.outputs.last_version_modern != ''
268
+ env :
269
+ CURRENT_VERSION_CLASSIC : ${{ needs.download_artifacts.outputs.current_version_classic }}
270
+ CURRENT_VERSION_MODERN : ${{ needs.download_artifacts.outputs.current_version_modern }}
271
+ LAST_VERSION_CLASSIC : ${{ needs.download_artifacts.outputs.last_version_classic }}
272
+ LAST_VERSION_MODERN : ${{ needs.download_artifacts.outputs.last_version_modern }}
273
+ run : |
274
+ echo "Re-applying $LAST_VERSION_CLASSIC to $CURRENT_VERSION_CLASSIC"
275
+ grep -rl "$LAST_VERSION_CLASSIC" ./compiled || echo "No files found with $LAST_VERSION_CLASSIC"
276
+ grep -rl "$LAST_VERSION_CLASSIC" ./compiled | xargs -r sed -i -e "s/$LAST_VERSION_CLASSIC/$CURRENT_VERSION_CLASSIC/g"
277
+ grep -rl "$LAST_VERSION_CLASSIC" ./compiled || echo "Classic version re-applied"
278
+ echo "===================="
279
+ echo "Re-applying $LAST_VERSION_MODERN to $CURRENT_VERSION_MODERN"
280
+ grep -rl "$LAST_VERSION_MODERN" ./compiled || echo "No files found with $LAST_VERSION_MODERN"
281
+ grep -rl "$LAST_VERSION_MODERN" ./compiled | xargs -r sed -i -e "s/$LAST_VERSION_MODERN/$CURRENT_VERSION_MODERN/g"
282
+ grep -rl "$LAST_VERSION_MODERN" ./compiled || echo "Classic version re-applied"
283
+ - name : Will commit these changes
284
+ if : steps.check_should_commit.outputs.should_commit == 'true'
285
+ run : |
286
+ echo ":"
287
+ git status -u
200
288
- name : Commit changes to branch
201
289
if : steps.check_should_commit.outputs.should_commit == 'true'
202
290
uses : stefanzweifel/git-auto-commit-action@v4
@@ -219,20 +307,52 @@ jobs:
219
307
with :
220
308
ref : builds/facebook-fbsource
221
309
- name : Ensure clean directory
222
- run : rm -rf compiled
310
+ run : rm -rf compiled-rn
223
311
- uses : actions/download-artifact@v3
224
312
with :
225
313
name : compiled-rn
226
314
path : compiled-rn/
227
- - run : git status -u
315
+ - name : Revert version changes
316
+ if : needs.download_artifacts.outputs.last_version_rn != ''
317
+ env :
318
+ CURRENT_VERSION : ${{ needs.download_artifacts.outputs.current_version_rn }}
319
+ LAST_VERSION : ${{ needs.download_artifacts.outputs.last_version_rn }}
320
+ run : |
321
+ echo "Reverting $CURRENT_VERSION to $LAST_VERSION"
322
+ grep -rl "$CURRENT_VERSION" ./compiled-rn || echo "No files found with $CURRENT_VERSION"
323
+ grep -rl "$CURRENT_VERSION" ./compiled-rn | xargs -r sed -i -e "s/$CURRENT_VERSION/$LAST_VERSION/g"
324
+ grep -rl "$CURRENT_VERSION" ./compiled-rn || echo "Version reverted"
228
325
- name : Check if only the REVISION file has changed
229
326
id : check_should_commit
230
327
run : |
231
- if git status --porcelain | grep -qv '/REVISION$'; then
328
+ echo "Full git status"
329
+ git status
330
+ echo "===================="
331
+ echo "Checking for changes"
332
+ # Check if there are changes in the files other than REVISION or @generated headers
333
+ # We also filter out the file name lines with "---" and "+++".
334
+ if git diff -- . ':(exclude)*REVISION' | grep -vE "^(@@|diff|index|\-\-\-|\+\+\+|@generated SignedSource)" | grep "^[+-]" > /dev/null; then
335
+ echo "Changes detected"
232
336
echo "should_commit=true" >> "$GITHUB_OUTPUT"
233
337
else
338
+ echo "No Changes detected"
234
339
echo "should_commit=false" >> "$GITHUB_OUTPUT"
235
340
fi
341
+ - name : Re-apply version changes
342
+ if : steps.check_should_commit.outputs.should_commit == 'true' && needs.download_artifacts.outputs.last_version_rn != ''
343
+ env :
344
+ CURRENT_VERSION : ${{ needs.download_artifacts.outputs.current_version_rn }}
345
+ LAST_VERSION : ${{ needs.download_artifacts.outputs.last_version_rn }}
346
+ run : |
347
+ echo "Re-applying $LAST_VERSION to $CURRENT_VERSION"
348
+ grep -rl "$LAST_VERSION" ./compiled-rn || echo "No files found with $LAST_VERSION"
349
+ grep -rl "$LAST_VERSION" ./compiled-rn | xargs -r sed -i -e "s/$LAST_VERSION/$CURRENT_VERSION/g"
350
+ grep -rl "$LAST_VERSION" ./compiled-rn || echo "Version re-applied"
351
+ - name : Will commit these changes
352
+ if : steps.check_should_commit.outputs.should_commit == 'true'
353
+ run : |
354
+ echo ":"
355
+ git status -u
236
356
- name : Commit changes to branch
237
357
if : steps.check_should_commit.outputs.should_commit == 'true'
238
358
uses : stefanzweifel/git-auto-commit-action@v4
0 commit comments