Use content hash for react-native builds (#26734)
This commit is contained in:
parent
559e83aebb
commit
5dd90c5623
|
@ -228,7 +228,16 @@ jobs:
|
||||||
name: compiled-rn
|
name: compiled-rn
|
||||||
path: compiled-rn/
|
path: compiled-rn/
|
||||||
- run: git status -u
|
- run: git status -u
|
||||||
|
- name: Check if only the REVISION file has changed
|
||||||
|
id: check_should_commit
|
||||||
|
run: |
|
||||||
|
if git status --porcelain | grep -qv '/REVISION$'; then
|
||||||
|
echo "should_commit=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "should_commit=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
- name: Commit changes to branch
|
- name: Commit changes to branch
|
||||||
|
if: steps.check_should_commit.outputs.should_commit == 'true'
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
with:
|
with:
|
||||||
commit_message: |
|
commit_message: |
|
||||||
|
|
|
@ -177,6 +177,26 @@ function processStable(buildDir) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const reactNativeBuildDir = buildDir + '/react-native/implementations/';
|
||||||
|
if (fs.existsSync(reactNativeBuildDir)) {
|
||||||
|
const hash = crypto.createHash('sha1');
|
||||||
|
for (const fileName of fs.readdirSync(reactNativeBuildDir).sort()) {
|
||||||
|
const filePath = reactNativeBuildDir + fileName;
|
||||||
|
const stats = fs.statSync(filePath);
|
||||||
|
if (!stats.isDirectory()) {
|
||||||
|
hash.update(fs.readFileSync(filePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updatePlaceholderReactVersionInCompiledArtifacts(
|
||||||
|
reactNativeBuildDir,
|
||||||
|
ReactVersion +
|
||||||
|
'-' +
|
||||||
|
nextChannelLabel +
|
||||||
|
'-' +
|
||||||
|
hash.digest('hex').slice(0, 8)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Update remaining placeholders with next channel version
|
// Update remaining placeholders with next channel version
|
||||||
updatePlaceholderReactVersionInCompiledArtifacts(
|
updatePlaceholderReactVersionInCompiledArtifacts(
|
||||||
buildDir,
|
buildDir,
|
||||||
|
|
Loading…
Reference in New Issue