Skip to content

Commit 61bf84a

Browse files
committed
Revert "Use content hash for facebook-www builds (#26331)"
This reverts commit 3cad3a5.
1 parent 182fa82 commit 61bf84a

File tree

2 files changed

+11
-33
lines changed

2 files changed

+11
-33
lines changed

.github/workflows/commit_artifacts.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
mkdir -p ${BASE_FOLDER}/react-native-github/Libraries/Renderer/
148148
mkdir -p ${BASE_FOLDER}/RKJSModules/vendor/react/{scheduler,react,react-is,react-test-renderer}/
149149
150-
# Move React Native renderer
150+
# Move React Native renderer
151151
mv build/react-native/implementations/ $BASE_FOLDER/react-native-github/Libraries/Renderer/
152152
mv build/react-native/shims/ $BASE_FOLDER/react-native-github/Libraries/Renderer/
153153
mv build/facebook-react-native/scheduler/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/scheduler/
@@ -161,9 +161,10 @@ jobs:
161161
rm $RENDERER_FOLDER/ReactNativeRenderer-{dev,prod,profiling}.js
162162
163163
ls -R ./compiled
164-
- name: Add REVISION file
164+
- name: Add REVISION files
165165
run: |
166166
echo ${{ github.sha }} >> ./compiled/facebook-www/REVISION
167+
cp ./compiled/facebook-www/REVISION ./compiled/facebook-www/REVISION_TRANSFORMS
167168
echo ${{ github.sha }} >> ./compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION
168169
- uses: actions/upload-artifact@v3
169170
with:
@@ -189,16 +190,7 @@ jobs:
189190
name: compiled
190191
path: compiled/
191192
- run: git status -u
192-
- name: Check if only the REVISION file has changed
193-
id: check_should_commit
194-
run: |
195-
if git status --porcelain | grep -qv '/REVISION$'; then
196-
echo "should_commit=true" >> "$GITHUB_OUTPUT"
197-
else
198-
echo "should_commit=false" >> "$GITHUB_OUTPUT"
199-
fi
200193
- name: Commit changes to branch
201-
if: steps.check_should_commit.outputs.should_commit == 'true'
202194
uses: stefanzweifel/git-auto-commit-action@v4
203195
with:
204196
commit_message: |

scripts/rollup/build-all-release-channels.js

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
/* eslint-disable no-for-of-loops/no-for-of-loops */
44

5-
const crypto = require('node:crypto');
65
const fs = require('fs');
76
const fse = require('fs-extra');
87
const {spawnSync} = require('child_process');
@@ -41,7 +40,10 @@ if (dateString.startsWith("'")) {
4140

4241
// Build the artifacts using a placeholder React version. We'll then do a string
4342
// replace to swap it with the correct version per release channel.
44-
const PLACEHOLDER_REACT_VERSION = ReactVersion + '-PLACEHOLDER';
43+
//
44+
// The placeholder version is the same format that the "next" channel uses
45+
const PLACEHOLDER_REACT_VERSION =
46+
ReactVersion + '-' + nextChannelLabel + '-' + sha + '-' + dateString;
4547

4648
// TODO: We should inject the React version using a build-time parameter
4749
// instead of overwriting the source files.
@@ -158,27 +160,19 @@ function processStable(buildDir) {
158160
}
159161

160162
if (fs.existsSync(buildDir + '/facebook-www')) {
161-
const hash = crypto.createHash('sha1');
162-
for (const fileName of fs.readdirSync(buildDir + '/facebook-www').sort()) {
163+
for (const fileName of fs.readdirSync(buildDir + '/facebook-www')) {
163164
const filePath = buildDir + '/facebook-www/' + fileName;
164165
const stats = fs.statSync(filePath);
165166
if (!stats.isDirectory()) {
166-
hash.update(fs.readFileSync(filePath));
167167
fs.renameSync(filePath, filePath.replace('.js', '.classic.js'));
168168
}
169169
}
170170
updatePlaceholderReactVersionInCompiledArtifacts(
171171
buildDir + '/facebook-www',
172-
ReactVersion + '-www-classic-' + hash.digest('hex').slice(0, 8)
172+
ReactVersion + '-www-classic-' + sha + '-' + dateString
173173
);
174174
}
175175

176-
// Update remaining placeholders with next channel version
177-
updatePlaceholderReactVersionInCompiledArtifacts(
178-
buildDir,
179-
ReactVersion + '-' + canaryChannelLabel + '-' + sha + '-' + dateString
180-
);
181-
182176
if (fs.existsSync(buildDir + '/sizes')) {
183177
fs.renameSync(buildDir + '/sizes', buildDir + '/sizes-stable');
184178
}
@@ -212,27 +206,19 @@ function processExperimental(buildDir, version) {
212206
}
213207

214208
if (fs.existsSync(buildDir + '/facebook-www')) {
215-
const hash = crypto.createHash('sha1');
216-
for (const fileName of fs.readdirSync(buildDir + '/facebook-www').sort()) {
209+
for (const fileName of fs.readdirSync(buildDir + '/facebook-www')) {
217210
const filePath = buildDir + '/facebook-www/' + fileName;
218211
const stats = fs.statSync(filePath);
219212
if (!stats.isDirectory()) {
220-
hash.update(fs.readFileSync(filePath));
221213
fs.renameSync(filePath, filePath.replace('.js', '.modern.js'));
222214
}
223215
}
224216
updatePlaceholderReactVersionInCompiledArtifacts(
225217
buildDir + '/facebook-www',
226-
ReactVersion + '-www-modern-' + hash.digest('hex').slice(0, 8)
218+
ReactVersion + '-www-modern-' + sha + '-' + dateString
227219
);
228220
}
229221

230-
// Update remaining placeholders with canary channel version
231-
updatePlaceholderReactVersionInCompiledArtifacts(
232-
buildDir,
233-
ReactVersion + '-' + canaryChannelLabel + '-' + sha + '-' + dateString
234-
);
235-
236222
if (fs.existsSync(buildDir + '/sizes')) {
237223
fs.renameSync(buildDir + '/sizes', buildDir + '/sizes-experimental');
238224
}

0 commit comments

Comments
 (0)