mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Remove dual Hermes version outputs from CI workflows (#56739)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56739 ## Summary - Simplify `publish-release.yml`: remove `HERMES_V1_VERSION` output, read only `HERMES_VERSION_NAME` - Simplify `create-draft-release.yml`: remove `hermesV1Version` input - Simplify `createDraftRelease.js`: remove `hermesV1Version` parameter and "Hermes V1 dSYMS" section from release notes - Simplify `prebuild-ios-core.yml`: read `HERMES_VERSION_NAME` instead of `HERMES_V1_VERSION_NAME` - Delete unused `prepare-hermes-v1-app` action, `hermes-v1.patch`, and `selectLatestHermesV1Version.js` ## Changelog: [Internal] ## Test plan - [x] JS tests: `yarn jest --no-watchman createDraftRelease-test.js` — 9/9 tests pass Reviewed By: cortinico Differential Revision: D104381269 fbshipit-source-id: 10544adcf5fa49fda583a80416b9621dc07915f7
This commit is contained in:
1 parent
d49aac6b65
commit
84b22ed791
8 files changed
+43
-164
No files matched your search
@@ -121,8 +121,12 @@ describe('Create Draft Release', () => {
|
||||
});
|
||||
|
||||
describe('#_computeBody', () => {
|
||||
it('computes body for release when no hermes versions are passed', async () => {
|
||||
it('falls back to HERMES_VERSION_NAME from version.properties when no hermes version is passed', async () => {
|
||||
const version = '0.77.1';
|
||||
const hermesVersion = '250829098.0.13';
|
||||
jest.spyOn(fs, 'readFileSync').mockImplementationOnce(() => {
|
||||
return `HERMES_VERSION_NAME=${hermesVersion}\n`;
|
||||
});
|
||||
const changelog = `## v${version}
|
||||
### Breaking Changes
|
||||
- [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change
|
||||
@@ -140,13 +144,9 @@ describe('Create Draft Release', () => {
|
||||
|
||||
---
|
||||
|
||||
Hermes dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
Hermes V1 dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-release.tar.gz)
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
ReactNativeDependencies dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz)
|
||||
@@ -172,7 +172,6 @@ View the whole changelog in the [CHANGELOG.md file](https://github.com/facebook/
|
||||
it('computes body for release when hermes versions are passed', async () => {
|
||||
const version = '0.77.1';
|
||||
const hermesVersion = '0.15.0';
|
||||
const hermesV1Version = '250829098.0.2';
|
||||
const changelog = `## v${version}
|
||||
### Breaking Changes
|
||||
- [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change
|
||||
@@ -184,25 +183,16 @@ View the whole changelog in the [CHANGELOG.md file](https://github.com/facebook/
|
||||
#### iOS
|
||||
- [PR #3436](https://github.com/facebook/react-native/pull/3436) - Some other change
|
||||
- [PR #3437](https://github.com/facebook/react-native/pull/3437) - Some other change`;
|
||||
const body = _computeBody(
|
||||
changelog,
|
||||
version,
|
||||
hermesVersion,
|
||||
hermesV1Version,
|
||||
);
|
||||
const body = _computeBody(changelog, version, hermesVersion);
|
||||
|
||||
expect(body).toEqual(`${changelog}
|
||||
|
||||
---
|
||||
|
||||
Hermes dSYMS:
|
||||
Hermes V1 dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
Hermes V1 dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
ReactNativeDependencies dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-release.tar.gz)
|
||||
|
||||
@@ -40,21 +40,33 @@ function _extractChangelog(version) {
|
||||
return changelog.slice(changelogStarts, changelogEnds).join('\n').trim();
|
||||
}
|
||||
|
||||
function _computeBody(changelog, version, hermesVersion, hermesV1Version) {
|
||||
hermesVersion = hermesVersion ?? version;
|
||||
hermesV1Version = hermesV1Version ?? version;
|
||||
function _readHermesVersionFromProperties() {
|
||||
const propertiesPath =
|
||||
'packages/react-native/sdks/hermes-engine/version.properties';
|
||||
const content = String(fs.readFileSync(propertiesPath, 'utf8'));
|
||||
const match = content.match(/^HERMES_VERSION_NAME=(.+)$/m);
|
||||
if (!match) {
|
||||
throw new Error(`HERMES_VERSION_NAME not found in ${propertiesPath}`);
|
||||
}
|
||||
return match[1].trim();
|
||||
}
|
||||
|
||||
function _computeBody(changelog, version, hermesVersion) {
|
||||
// The workflow input is optional and arrives as an empty string when unset,
|
||||
// so treat both missing and empty as "fall back to version.properties".
|
||||
// Falling back to ${version} would produce 404 dSYMS URLs since Hermes V1
|
||||
// versions (e.g. 250829098.0.13) don't track RN versions.
|
||||
if (hermesVersion == null || hermesVersion === '') {
|
||||
hermesVersion = _readHermesVersionFromProperties();
|
||||
}
|
||||
return `${changelog}
|
||||
|
||||
---
|
||||
|
||||
Hermes dSYMS:
|
||||
Hermes V1 dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
Hermes V1 dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
ReactNativeDependencies dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-release.tar.gz)
|
||||
@@ -123,13 +135,7 @@ function moveToChangelogBranch(version) {
|
||||
run(`git checkout -b changelog/v${version}`);
|
||||
}
|
||||
|
||||
async function createDraftRelease(
|
||||
version,
|
||||
latest,
|
||||
token,
|
||||
hermesVersion,
|
||||
hermesV1Version,
|
||||
) {
|
||||
async function createDraftRelease(version, latest, token, hermesVersion) {
|
||||
if (version.startsWith('v')) {
|
||||
version = version.substring(1);
|
||||
}
|
||||
@@ -137,7 +143,7 @@ async function createDraftRelease(
|
||||
_verifyTagExists(version);
|
||||
moveToChangelogBranch(version);
|
||||
const changelog = _extractChangelog(version);
|
||||
const body = _computeBody(changelog, version, hermesVersion, hermesV1Version);
|
||||
const body = _computeBody(changelog, version, hermesVersion);
|
||||
const release = await _createDraftReleaseOnGitHub(
|
||||
version,
|
||||
body,
|
||||
@@ -155,4 +161,5 @@ module.exports = {
|
||||
_extractChangelog,
|
||||
_computeBody,
|
||||
_createDraftReleaseOnGitHub,
|
||||
_readHermesVersionFromProperties,
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
diff --git a/android/settings.gradle b/android/settings.gradle
|
||||
index 63b5d4e..6359ec3 100644
|
||||
--- a/android/settings.gradle
|
||||
+++ b/android/settings.gradle
|
||||
@@ -4,3 +4,11 @@ extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autoli
|
||||
rootProject.name = 'RNApp'
|
||||
include ':app'
|
||||
includeBuild('../node_modules/@react-native/gradle-plugin')
|
||||
+
|
||||
+includeBuild('../node_modules/react-native') {
|
||||
+ dependencySubstitution {
|
||||
+ substitute(module("com.facebook.react:react-android")).using(project(":packages:react-native:ReactAndroid"))
|
||||
+ substitute(module("com.facebook.react:react-native")).using(project(":packages:react-native:ReactAndroid"))
|
||||
+ substitute(project(":packages:react-native:ReactAndroid:hermes-engine")).using(module("com.facebook.hermes:hermes-android:$HERMES_V1_VERSION"))
|
||||
+ }
|
||||
+}
|
||||
diff --git a/package.json b/package.json
|
||||
index f05d51b..69938af 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -35,6 +35,9 @@
|
||||
"react-test-renderer": "19.2.0",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
+ "resolutions": {
|
||||
+ "hermes-compiler": "$HERMES_V1_VERSION"
|
||||
+ },
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const PATCH_FILE_PATH = path.join(__dirname, 'hermes-v1.patch');
|
||||
|
||||
function getLatestHermesV1Version() {
|
||||
const npmString = "npm view hermes-compiler@latest-v1 version";
|
||||
|
||||
try {
|
||||
const result = execSync(npmString, { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
|
||||
return result;
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to get package version for hermes-compiler@latest-v1`);
|
||||
}
|
||||
}
|
||||
|
||||
function setHermesV1VersionInPatch(version) {
|
||||
if (!fs.existsSync(PATCH_FILE_PATH)) {
|
||||
throw new Error(`Patch file not found at path: ${PATCH_FILE_PATH}`);
|
||||
}
|
||||
|
||||
let patchContent = fs.readFileSync(PATCH_FILE_PATH, 'utf8');
|
||||
const updatedContent = patchContent.replaceAll(
|
||||
"$HERMES_V1_VERSION",
|
||||
version
|
||||
);
|
||||
fs.writeFileSync(PATCH_FILE_PATH, updatedContent, 'utf8');
|
||||
}
|
||||
|
||||
setHermesV1VersionInPatch(getLatestHermesV1Version());
|
||||
Reference in new issue
Block a user