1
+name: (Runtime) Commit Artifacts for Meta WWW and fbsource V2
2
+
3
+on:
4
+ workflow_run:
5
+ workflows: ["(Runtime) Build and Test"]
6
+ types: [completed]
7
+ branches:
8
+ - main
9
+
10
+env:
11
+ TZ: /usr/share/zoneinfo/America/Los_Angeles
12
+
13
+jobs:
14
+ download_artifacts:
15
+ runs-on: ubuntu-latest
16
+ outputs:
17
+ www_branch_count: ${{ steps.check_branches.outputs.www_branch_count }}
18
+ fbsource_branch_count: ${{ steps.check_branches.outputs.fbsource_branch_count }}
19
+ last_version_classic: ${{ steps.get_last_version_www.outputs.last_version_classic }}
20
+ last_version_modern: ${{ steps.get_last_version_www.outputs.last_version_modern }}
21
+ last_version_rn: ${{ steps.get_last_version_rn.outputs.last_version_rn }}
22
+ current_version_classic: ${{ steps.get_current_version.outputs.current_version_classic }}
23
+ current_version_modern: ${{ steps.get_current_version.outputs.current_version_modern }}
24
+ current_version_rn: ${{ steps.get_current_version.outputs.current_version_rn }}
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ with:
28
+ ref: builds/facebook-www
29
+ - name: "Get last version string for www"
30
+ id: get_last_version_www
31
+ run: |
32
+ # Empty checks only needed for backwards compatibility,can remove later.
33
+ VERSION_CLASSIC=$( [ -f ./compiled/facebook-www/VERSION_CLASSIC ] && cat ./compiled/facebook-www/VERSION_CLASSIC || echo '' )
34
+ VERSION_MODERN=$( [ -f ./compiled/facebook-www/VERSION_MODERN ] && cat ./compiled/facebook-www/VERSION_MODERN || echo '' )
35
+ echo "Last classic version is $VERSION_CLASSIC"
36
+ echo "Last modern version is $VERSION_MODERN"
37
+ echo "last_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT"
38
+ echo "last_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT"
39
+ - uses: actions/checkout@v4
40
+ with:
41
+ ref: builds/facebook-fbsource
42
+ - name: "Get last version string for rn"
43
+ id: get_last_version_rn
44
+ run: |
45
+ # Empty checks only needed for backwards compatibility,can remove later.
46
+ VERSION_NATIVE_FB=$( [ -f ./compiled-rn/VERSION_NATIVE_FB ] && cat ./compiled-rn/VERSION_NATIVE_FB || echo '' )
47
+ echo "Last rn version is $VERSION_NATIVE_FB"
48
+ echo "last_version_rn=$VERSION_NATIVE_FB" >> "$GITHUB_OUTPUT"
49
+ - uses: actions/checkout@v4
50
+ - name: "Check branches"
51
+ id: check_branches
52
+ run: |
53
+ echo "www_branch_count=$(git ls-remote --heads origin "refs/heads/meta-www" | wc -l)" >> "$GITHUB_OUTPUT"
54
+ echo "fbsource_branch_count=$(git ls-remote --heads origin "refs/heads/meta-fbsource" | wc -l)" >> "$GITHUB_OUTPUT"
55
+ - uses: actions/setup-node@v4
56
+ with:
57
+ node-version: 18.20.1
58
+ cache: yarn
59
+ cache-dependency-path: yarn.lock
60
+ - name: Restore cached node_modules
61
+ uses: actions/cache@v4
62
+ id: node_modules
63
+ with:
64
+ path: "**/node_modules"
65
+ key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
66
+ - run: yarn install --frozen-lockfile
67
+ - run: yarn install --frozen-lockfile
68
+ working-directory: scripts/release
69
+ - name: Download artifacts for base revision
70
+ run: |
71
+ git fetch origin main
72
+ GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build-ghaction.js --commit=$(git rev-parse origin/main)
73
+ - name: Display structure of build
74
+ run: ls -R build
75
+ - name: Strip @license from eslint plugin and react-refresh
76
+ run: |
77
+ sed -i -e 's/ @license React*//' \
78
+ build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \
79
+ build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js
80
+ - name: Move relevant files for React in www into compiled
81
+ run: |
82
+ # Move the facebook-www folder into compiled
83
+ mkdir ./compiled
84
+ mv build/facebook-www ./compiled
85
+
86
+ # Move ReactAllWarnings.js to facebook-www
87
+ mkdir ./compiled/facebook-www/__test_utils__
88
+ mv build/__test_utils__/ReactAllWarnings.js ./compiled/facebook-www/__test_utils__/ReactAllWarnings.js
89
+
90
+ # Move eslint-plugin-react-hooks into facebook-www
91
+ mv build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \
92
+ ./compiled/facebook-www/eslint-plugin-react-hooks.js
93
+
94
+ # Move unstable_server-external-runtime.js into facebook-www
95
+ mv build/oss-experimental/react-dom/unstable_server-external-runtime.js \
96
+ ./compiled/facebook-www/unstable_server-external-runtime.js
97
+
98
+ # Move react-refresh-babel.development.js into babel-plugin-react-refresh
99
+ mkdir ./compiled/babel-plugin-react-refresh
100
+ mv build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js \
101
+ ./compiled/babel-plugin-react-refresh/index.js
102
+
103
+ ls -R ./compiled
104
+ - name: Move relevant files for React in fbsource into compiled-rn
105
+ run: |
106
+ BASE_FOLDER='compiled-rn/facebook-fbsource/xplat/js'
107
+ mkdir -p ${BASE_FOLDER}/react-native-github/Libraries/Renderer/
108
+ mkdir -p ${BASE_FOLDER}/RKJSModules/vendor/react/{scheduler,react,react-is,react-test-renderer}/
109
+
110
+ # Move React Native renderer
111
+ mv build/react-native/implementations/ $BASE_FOLDER/react-native-github/Libraries/Renderer/
112
+ mv build/react-native/shims/ $BASE_FOLDER/react-native-github/Libraries/Renderer/
113
+ mv build/facebook-react-native/scheduler/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/scheduler/
114
+ mv build/facebook-react-native/react/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/react/
115
+ mv build/facebook-react-native/react-is/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/react-is/
116
+ mv build/facebook-react-native/react-test-renderer/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/react-test-renderer/
117
+
118
+ # Delete OSS renderer. OSS renderer is synced through internal script.
119
+ RENDERER_FOLDER=$BASE_FOLDER/react-native-github/Libraries/Renderer/implementations/
120
+ rm $RENDERER_FOLDER/ReactFabric-{dev,prod,profiling}.js
121
+ rm $RENDERER_FOLDER/ReactNativeRenderer-{dev,prod,profiling}.js
122
+
123
+ # Move React Native version file
124
+ mv build/facebook-react-native/VERSION_NATIVE_FB ./compiled-rn/VERSION_NATIVE_FB
125
+
126
+ ls -R ./compiled-rn
127
+ - name: Add REVISION files
128
+ run: |
129
+ echo ${{ github.sha }} >> ./compiled/facebook-www/REVISION
130
+ cp ./compiled/facebook-www/REVISION ./compiled/facebook-www/REVISION_TRANSFORMS
131
+ echo ${{ github.sha }} >> ./compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION
132
+ - name: "Get current version string"
133
+ id: get_current_version
134
+ run: |
135
+ VERSION_CLASSIC=$(cat ./compiled/facebook-www/VERSION_CLASSIC)
136
+ VERSION_MODERN=$(cat ./compiled/facebook-www/VERSION_MODERN)
137
+ VERSION_NATIVE_FB=$(cat ./compiled-rn/VERSION_NATIVE_FB)
138
+ echo "Current classic version is $VERSION_CLASSIC"
139
+ echo "Current modern version is $VERSION_MODERN"
140
+ echo "Current rn version is $VERSION_NATIVE_FB"
141
+ echo "current_version_classic=$VERSION_CLASSIC" >> "$GITHUB_OUTPUT"
142
+ echo "current_version_modern=$VERSION_MODERN" >> "$GITHUB_OUTPUT"
143
+ echo "current_version_rn=$VERSION_NATIVE_FB" >> "$GITHUB_OUTPUT"
144
+ - uses: actions/upload-artifact@v3
145
+ with:
146
+ name: compiled
147
+ path: compiled/
148
+ - uses: actions/upload-artifact@v3
149
+ with:
150
+ name: compiled-rn
151
+ path: compiled-rn/