1
- name : Commit Artifacts for Facebook WWW
1
+ name : Commit Artifacts for Facebook WWW and fbsource
2
2
3
3
on :
4
4
push :
10
10
steps :
11
11
- name : Download and unzip artifacts
12
12
uses : actions/github-script@v6
13
+ env :
14
+ CIRCLECI_TOKEN : ${{secrets.CIRCLECI_TOKEN_DIFFTRAIN}}
13
15
with :
14
16
script : |
15
17
const cp = require('child_process');
@@ -58,10 +60,10 @@ jobs:
58
60
const ciBuildId = /\/facebook\/react\/([0-9]+)/.exec(
59
61
status.target_url,
60
62
)[1];
61
- console.log(`CircleCI build id found: ${ciBuildId}`);
62
63
if (Number.parseInt(ciBuildId, 10) + '' === ciBuildId) {
63
64
artifactsUrl =
64
65
`https://circleci.com/api/v1.1/project/github/facebook/react/${ciBuildId}/artifacts`;
66
+ console.log(`Found artifactsUrl: ${artifactsUrl}`);
65
67
break spinloop;
66
68
} else {
67
69
throw new Error(`${ciBuildId} isn't a number`);
@@ -80,13 +82,21 @@ jobs:
80
82
await sleep(60_000);
81
83
}
82
84
if (artifactsUrl != null) {
83
- const res = await fetch(artifactsUrl);
85
+ const {CIRCLECI_TOKEN} = process.env;
86
+ const res = await fetch(artifactsUrl, {
87
+ headers: {
88
+ 'Circle-Token': CIRCLECI_TOKEN
89
+ }
90
+ });
84
91
const data = await res.json();
92
+ if (!Array.isArray(data) && data.message != null) {
93
+ throw `CircleCI returned: ${data.message}`;
94
+ }
85
95
for (const artifact of data) {
86
96
if (artifact.path === 'build.tgz') {
87
97
console.log(`Downloading and unzipping ${artifact.url}`);
88
98
await execHelper(
89
- `curl -L ${artifact.url} | tar -xvz`
99
+ `curl -L ${artifact.url} -H "Circle-Token: ${CIRCLECI_TOKEN}" | tar -xvz`
90
100
);
91
101
}
92
102
}
98
108
sed -i -e 's/ @license React*//' \
99
109
build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \
100
110
build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js
101
- - name : Move relevant files into compiled
111
+ - name : Move relevant files for React in www into compiled
102
112
run : |
103
113
mkdir -p ./compiled
104
114
mkdir -p ./compiled/facebook-www
@@ -122,16 +132,41 @@ jobs:
122
132
mv build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js \
123
133
./compiled/babel-plugin-react-refresh/index.js
124
134
135
+ ls -R ./compiled
136
+ - name : Move relevant files for React in fbsource into compiled-rn
137
+ run : |
138
+ BASE_FOLDER='compiled-rn/facebook-fbsource/xplat/js'
139
+ mkdir -p ${BASE_FOLDER}/react-native-github/Libraries/Renderer/
140
+ mkdir -p ${BASE_FOLDER}/RKJSModules/vendor/{scheduler,react,react-is,react-test-renderer}/
141
+
142
+ # Move React Native renderer
143
+ mv build/react-native/implementations/ $BASE_FOLDER/react-native-github/Libraries/Renderer/
144
+ mv build/react-native/shims/ $BASE_FOLDER/react-native-github/Libraries/Renderer/
145
+ mv build/facebook-react-native/scheduler/cjs/ $BASE_FOLDER/RKJSModules/vendor/scheduler/
146
+ mv build/facebook-react-native/react/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/
147
+ mv build/facebook-react-native/react-is/cjs/ $BASE_FOLDER/RKJSModules/vendor/react-is/
148
+ mv build/facebook-react-native/react-test-renderer/cjs/ $BASE_FOLDER/RKJSModules/vendor/react-test-renderer/
149
+
150
+ # Delete OSS renderer. OSS renderer is synced through internal script.
151
+ RENDERER_FOLDER=$BASE_FOLDER/react-native-github/Libraries/Renderer/implementations/
152
+ rm $RENDERER_FOLDER/ReactFabric-{dev,prod,profiling}.js
153
+ rm $RENDERER_FOLDER/ReactNativeRenderer-{dev,prod,profiling}.js
154
+
125
155
ls -R ./compiled
126
156
- name : Add REVISION file
127
157
run : |
128
158
echo ${{ github.sha }} >> ./compiled/facebook-www/REVISION
159
+ echo ${{ github.sha }} >> ./compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION
129
160
- uses : actions/upload-artifact@v3
130
161
with :
131
162
name : compiled
132
163
path : compiled/
164
+ - uses : actions/upload-artifact@v3
165
+ with :
166
+ name : compiled-rn
167
+ path : compiled-rn/
133
168
134
- commit_artifacts :
169
+ commit_www_artifacts :
135
170
needs : download_artifacts
136
171
runs-on : ubuntu-latest
137
172
steps :
@@ -165,3 +200,29 @@ jobs:
165
200
commit_user_name : ${{ github.actor }}
166
201
commit_user_email : ${{ github.actor }}@users.noreply.github.com
167
202
create_branch : true
203
+
204
+ commit_fbsource_artifacts :
205
+ needs : download_artifacts
206
+ runs-on : ubuntu-latest
207
+ steps :
208
+ - uses : actions/checkout@v3
209
+ with :
210
+ ref : main
211
+ repository : facebook/react-fbsource-import
212
+ token : ${{secrets.FBSOURCE_SYNC_PUSH_TOKEN}}
213
+ - name : Ensure clean directory
214
+ run : rm -rf compiled-rn
215
+ - uses : actions/download-artifact@v3
216
+ with :
217
+ name : compiled-rn
218
+ path : compiled-rn/
219
+ - run : git status -u
220
+ - name : Commit changes to branch
221
+ uses : stefanzweifel/git-auto-commit-action@v4
222
+ with :
223
+ commit_message : |
224
+ ${{ github.event.head_commit.message }}
225
+
226
+ DiffTrain build for commit https://github.com/facebook/react/commit/${{ github.sha }}.
227
+ commit_user_name : ${{ github.actor }}
228
+ commit_user_email : ${{ github.actor }}@users.noreply.github.com
0 commit comments