mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Consolidate Hermes version files and simplify JS release scripts (#56737)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56737 - Remove `sdks/.hermesversion` from `package.json` files array — only `.hermesv1version` remains - Simplify `hermes-utils.js`: remove `readHermesTag()`, `HERMES_TAG_FILE_PATH`; `setHermesTag()` takes single argument - Simplify `scripts/releases/utils/hermes-utils.js`: single version in `getLatestHermesNightlyVersion()` and `updateHermesRuntimeDependenciesVersions()` - Simplify `bump-hermes-version.js`: remove `--tag` and `--hermes-version` CLI options - Simplify `release-hermes-for-branch-cut.js`: remove legacy branch/workflow/PR logic, keep only single Hermes branch ## Changelog: [General][Changed] - Simplified build JS Hermes infrastructure for the Release ## Test plan - [x] JS tests: `yarn jest --no-watchman hermes-utils-test.js` — 5/5 tests pass Reviewed By: cortinico Differential Revision: D104380961 fbshipit-source-id: b9658d88624001a820b9838c84f1775995e9bc52
This commit is contained in:
1 parent
940ee8ae0d
commit
d49aac6b65
6 files changed
+104
-296
No files matched your search
@@ -127,7 +127,6 @@
|
||||
"scripts/xcode/ccache-clang++.sh",
|
||||
"scripts/xcode/ccache.conf",
|
||||
"scripts/xcode/with-environment.sh",
|
||||
"sdks/.hermesversion",
|
||||
"sdks/.hermesv1version",
|
||||
"sdks/hermes-engine",
|
||||
"sdks/hermesc",
|
||||
|
||||
@@ -10,17 +10,12 @@
|
||||
|
||||
import * as path from 'path';
|
||||
|
||||
const {
|
||||
readHermesTag,
|
||||
readHermesV1Tag,
|
||||
setHermesTag,
|
||||
} = require('../hermes-utils');
|
||||
const {readHermesTag, setHermesTag} = require('../hermes-utils');
|
||||
// $FlowFixMe[untyped-import] (OSS) memfs
|
||||
const {memfs} = require('memfs');
|
||||
|
||||
const hermesTag =
|
||||
'hermes-2022-04-28-RNv0.69.0-15d07c2edd29a4ea0b8f15ab0588a0c1adb1200f';
|
||||
const hermesV1Tag = '250829098.0.0';
|
||||
const ROOT_DIR = path.normalize(path.join(__dirname, '../../..'));
|
||||
const SDKS_DIR = path.join(ROOT_DIR, 'sdks');
|
||||
|
||||
@@ -44,62 +39,36 @@ describe('hermes-utils', () => {
|
||||
|
||||
describe('Versioning Hermes', () => {
|
||||
describe('readHermesTag', () => {
|
||||
it('should throw if .hermesversion does not exist', () => {
|
||||
it('should throw if .hermesv1version does not exist', () => {
|
||||
expect(() => {
|
||||
readHermesTag();
|
||||
}).toThrow('[Hermes] .hermesversion does not exist.');
|
||||
}).toThrow('[Hermes] .hermesv1version does not exist.');
|
||||
});
|
||||
it('should fail if hermes tag is empty', () => {
|
||||
fs.writeFileSync(path.join(SDKS_DIR, '.hermesversion'), '');
|
||||
fs.writeFileSync(path.join(SDKS_DIR, '.hermesv1version'), '');
|
||||
expect(() => {
|
||||
readHermesTag();
|
||||
}).toThrow('[Hermes] .hermesversion file is empty.');
|
||||
}).toThrow('[Hermes] .hermesv1version file is empty.');
|
||||
});
|
||||
it('should return tag from .hermesversion if file exists', () => {
|
||||
fs.writeFileSync(path.join(SDKS_DIR, '.hermesversion'), hermesTag);
|
||||
it('should return tag from .hermesv1version if file exists', () => {
|
||||
fs.writeFileSync(path.join(SDKS_DIR, '.hermesv1version'), hermesTag);
|
||||
expect(readHermesTag()).toEqual(hermesTag);
|
||||
});
|
||||
});
|
||||
|
||||
describe('readHermesV1Tag', () => {
|
||||
it('should throw if .hermesv1version does not exist', () => {
|
||||
expect(() => {
|
||||
readHermesV1Tag();
|
||||
}).toThrow('[Hermes] .hermesv1version does not exist.');
|
||||
});
|
||||
it('should fail if hermes v1 tag is empty', () => {
|
||||
fs.writeFileSync(path.join(SDKS_DIR, '.hermesv1version'), '');
|
||||
expect(() => {
|
||||
readHermesV1Tag();
|
||||
}).toThrow('[Hermes] .hermesv1version file is empty.');
|
||||
});
|
||||
it('should return tag from .hermesv1version if file exists', () => {
|
||||
fs.writeFileSync(path.join(SDKS_DIR, '.hermesv1version'), hermesV1Tag);
|
||||
expect(readHermesV1Tag()).toEqual(hermesV1Tag);
|
||||
});
|
||||
});
|
||||
|
||||
describe('setHermesTag', () => {
|
||||
it('should write tag to .hermesversion file', async () => {
|
||||
await setHermesTag(hermesTag, hermesV1Tag);
|
||||
expect(
|
||||
fs.readFileSync(path.join(SDKS_DIR, '.hermesversion'), {
|
||||
encoding: 'utf8',
|
||||
flag: 'r',
|
||||
}),
|
||||
).toEqual(hermesTag);
|
||||
|
||||
it('should write tag to .hermesv1version file', async () => {
|
||||
await setHermesTag(hermesTag);
|
||||
expect(
|
||||
fs.readFileSync(path.join(SDKS_DIR, '.hermesv1version'), {
|
||||
encoding: 'utf8',
|
||||
flag: 'r',
|
||||
}),
|
||||
).toEqual(hermesV1Tag);
|
||||
).toEqual(hermesTag);
|
||||
});
|
||||
it('should set Hermes tag and read it back', async () => {
|
||||
await setHermesTag(hermesTag, hermesV1Tag);
|
||||
await setHermesTag(hermesTag);
|
||||
expect(readHermesTag()).toEqual(hermesTag);
|
||||
expect(readHermesV1Tag()).toEqual(hermesV1Tag);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+14
-61
@@ -28,88 +28,41 @@ const inquirer = require('inquirer');
|
||||
const {exit} = require('shelljs');
|
||||
const yargs = require('yargs');
|
||||
|
||||
let argv = yargs
|
||||
.option('t', {
|
||||
alias: 'tag',
|
||||
describe:
|
||||
'Hermes release tag to use for this React Native release, ex. hermes-2022-02-21-RNv0.68.0. This tag will be used when building Hermes from source.',
|
||||
required: true,
|
||||
})
|
||||
.option('s', {
|
||||
alias: 'v1-tag',
|
||||
describe:
|
||||
'Hermes V1 release tag to use for this React Native release, ex. 250829098.0.0. This tag will be used when building Hermes V1 from source.',
|
||||
required: true,
|
||||
})
|
||||
.option('h', {
|
||||
alias: 'hermes-version',
|
||||
describe:
|
||||
'Hermes version to use for this React Native release, ex. 250829098.0.0. This version will be used when consuming Hermes from a prebuilt package.',
|
||||
required: false,
|
||||
})
|
||||
.option('v', {
|
||||
alias: 'hermes-v1-version',
|
||||
describe:
|
||||
'Hermes V1 version to use for this React Native release, ex. 250829098.0.0. This version will be used when consuming Hermes V1 from a prebuilt package.',
|
||||
required: false,
|
||||
}).argv;
|
||||
let argv = yargs.option('v', {
|
||||
alias: 'version',
|
||||
describe:
|
||||
'Hermes version to use for this React Native release, ex. hermes-250829098.0.0. Used both as the .hermesv1version tag (for building from source) and as the prebuilt package version. If omitted, the latest published version is fetched from NPM.',
|
||||
required: false,
|
||||
}).argv;
|
||||
|
||||
async function main() {
|
||||
// $FlowFixMe[prop-missing]
|
||||
const hermesTag = argv.tag;
|
||||
// $FlowFixMe[prop-missing]
|
||||
const hermesV1Tag = argv['v1-tag'];
|
||||
// $FlowFixMe[prop-missing]
|
||||
let hermesVersion = argv['hermes-version'];
|
||||
// $FlowFixMe[prop-missing]
|
||||
let hermesV1Version = argv['hermes-v1-version'];
|
||||
let hermesVersion = argv.version;
|
||||
|
||||
if (!hermesVersion) {
|
||||
console.log(
|
||||
'No Hermes version provided. Fetching the latest version from NPM...',
|
||||
);
|
||||
hermesVersion = await getPackageVersionStrByTag(
|
||||
'hermes-compiler',
|
||||
'latest-v0',
|
||||
);
|
||||
}
|
||||
|
||||
if (!hermesV1Version) {
|
||||
console.log(
|
||||
'No Hermes V1 version provided. Fetching the latest version from NPM...',
|
||||
);
|
||||
hermesV1Version = await getPackageVersionStrByTag(
|
||||
'hermes-compiler',
|
||||
'latest-v1',
|
||||
);
|
||||
}
|
||||
|
||||
const {confirmHermesVersions} = await inquirer.prompt({
|
||||
const {confirmHermesVersion} = await inquirer.prompt({
|
||||
type: 'confirm',
|
||||
name: 'confirmHermesVersions',
|
||||
message: `Do you want to use the Hermes version "${hermesVersion}" and Hermes V1 version "${hermesV1Version}" (for prebuilt)?`,
|
||||
name: 'confirmHermesVersion',
|
||||
message: `Do you want to use the Hermes version "${hermesVersion}"?`,
|
||||
});
|
||||
|
||||
if (!confirmHermesVersions) {
|
||||
if (!confirmHermesVersion) {
|
||||
console.log('Aborting.');
|
||||
return;
|
||||
}
|
||||
|
||||
const {confirmHermesTags} = await inquirer.prompt({
|
||||
type: 'confirm',
|
||||
name: 'confirmHermesTags',
|
||||
message: `Do you want to use the Hermes release tagged "${hermesTag}" and Hermes V1 release tagged "${hermesV1Tag}" (for building from source)?`,
|
||||
});
|
||||
|
||||
if (!confirmHermesTags) {
|
||||
console.log('Aborting.');
|
||||
return;
|
||||
}
|
||||
|
||||
await setHermesTag(hermesTag, hermesV1Tag);
|
||||
|
||||
await updateHermesCompilerVersionInDependencies(hermesV1Version);
|
||||
await updateHermesRuntimeDependenciesVersions(hermesV1Version);
|
||||
await setHermesTag(hermesVersion);
|
||||
await updateHermesCompilerVersionInDependencies(hermesVersion);
|
||||
await updateHermesRuntimeDependenciesVersions(hermesVersion);
|
||||
}
|
||||
|
||||
void main().then(() => {
|
||||
|
||||
+28
-59
@@ -20,8 +20,7 @@ type BuildType = 'dry-run' | 'release' | 'nightly';
|
||||
*/
|
||||
|
||||
const SDKS_DIR = path.normalize(path.join(__dirname, '..', '..', 'sdks'));
|
||||
const HERMES_TAG_FILE_PATH = path.join(SDKS_DIR, '.hermesversion');
|
||||
const HERMES_V1_TAG_FILE_PATH = path.join(SDKS_DIR, '.hermesv1version');
|
||||
const HERMES_TAG_FILE_PATH = path.join(SDKS_DIR, '.hermesv1version');
|
||||
|
||||
function readHermesTag() /*: string */ {
|
||||
if (fs.existsSync(HERMES_TAG_FILE_PATH)) {
|
||||
@@ -32,25 +31,6 @@ function readHermesTag() /*: string */ {
|
||||
})
|
||||
.trim();
|
||||
|
||||
if (data.length > 0) {
|
||||
return data;
|
||||
} else {
|
||||
throw new Error('[Hermes] .hermesversion file is empty.');
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('[Hermes] .hermesversion does not exist.');
|
||||
}
|
||||
|
||||
function readHermesV1Tag() /*: string */ {
|
||||
if (fs.existsSync(HERMES_V1_TAG_FILE_PATH)) {
|
||||
const data = fs
|
||||
.readFileSync(HERMES_V1_TAG_FILE_PATH, {
|
||||
encoding: 'utf8',
|
||||
flag: 'r',
|
||||
})
|
||||
.trim();
|
||||
|
||||
if (data.length > 0) {
|
||||
return data;
|
||||
} else {
|
||||
@@ -61,51 +41,40 @@ function readHermesV1Tag() /*: string */ {
|
||||
throw new Error('[Hermes] .hermesv1version does not exist.');
|
||||
}
|
||||
|
||||
async function updateHermesTag(
|
||||
tagFile /*: string */,
|
||||
hermesTag /*: string */,
|
||||
prompt /*: string */,
|
||||
) {
|
||||
if (!fs.existsSync(tagFile)) {
|
||||
fs.writeFileSync(tagFile, hermesTag.trim());
|
||||
} else {
|
||||
const previousHermesTag = fs.readFileSync(tagFile, {
|
||||
encoding: 'utf8',
|
||||
flag: 'r',
|
||||
});
|
||||
|
||||
if (previousHermesTag.trim() !== hermesTag.trim()) {
|
||||
const {confirmHermesTag} = await inquirer.prompt({
|
||||
type: 'confirm',
|
||||
name: 'confirmHermesTag',
|
||||
message: `Do you want to use updtate release tag for ${prompt} from "${previousHermesTag}" to "${hermesTag}"?`,
|
||||
});
|
||||
|
||||
if (confirmHermesTag) {
|
||||
fs.writeFileSync(tagFile, hermesTag.trim());
|
||||
} else {
|
||||
console.log(`[${prompt}] .hermesversion file is unchanged.`);
|
||||
}
|
||||
} else {
|
||||
console.log(`[${prompt}] .hermesversion file is unchanged.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function setHermesTag(
|
||||
hermesTag /*: string */,
|
||||
hermesV1Tag /*: string */,
|
||||
) {
|
||||
async function setHermesTag(hermesTag /*: string */) {
|
||||
if (!fs.existsSync(SDKS_DIR)) {
|
||||
fs.mkdirSync(SDKS_DIR, {recursive: true});
|
||||
}
|
||||
|
||||
await updateHermesTag(HERMES_TAG_FILE_PATH, hermesTag, 'Hermes');
|
||||
await updateHermesTag(HERMES_V1_TAG_FILE_PATH, hermesV1Tag, 'Hermes V1');
|
||||
if (!fs.existsSync(HERMES_TAG_FILE_PATH)) {
|
||||
fs.writeFileSync(HERMES_TAG_FILE_PATH, hermesTag.trim());
|
||||
return;
|
||||
}
|
||||
|
||||
const previousHermesTag = fs.readFileSync(HERMES_TAG_FILE_PATH, {
|
||||
encoding: 'utf8',
|
||||
flag: 'r',
|
||||
});
|
||||
|
||||
if (previousHermesTag.trim() === hermesTag.trim()) {
|
||||
console.log('[Hermes] .hermesv1version file is unchanged.');
|
||||
return;
|
||||
}
|
||||
|
||||
const {confirmHermesTag} = await inquirer.prompt({
|
||||
type: 'confirm',
|
||||
name: 'confirmHermesTag',
|
||||
message: `Do you want to update release tag for Hermes from "${previousHermesTag}" to "${hermesTag}"?`,
|
||||
});
|
||||
|
||||
if (confirmHermesTag) {
|
||||
fs.writeFileSync(HERMES_TAG_FILE_PATH, hermesTag.trim());
|
||||
} else {
|
||||
console.log('[Hermes] .hermesv1version file is unchanged.');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
readHermesTag,
|
||||
readHermesV1Tag,
|
||||
setHermesTag,
|
||||
};
|
||||
@@ -39,10 +39,8 @@ const argv = yargs
|
||||
const DRY_RUN = argv['dry-run'];
|
||||
|
||||
const HERMES_REPO_PATH = path.join(os.homedir(), 'git', 'hermes');
|
||||
const HERMES_LEGACY_BRANCH = 'main';
|
||||
const HERMES_LEGACY_LABEL = 'Hermes Legacy';
|
||||
const HERMES_V1_BRANCH = '250829098.0.0-stable';
|
||||
const HERMES_V1_LABEL = 'Hermes V1';
|
||||
const HERMES_BRANCH = '250829098.0.0-stable';
|
||||
const HERMES_LABEL = 'Hermes';
|
||||
const RN_REPO_ROOT = path.resolve(__dirname, '..', '..', '..', '..');
|
||||
|
||||
async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
@@ -98,20 +96,16 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Step 3: Get versions from Hermes
|
||||
console.log('\n📥 Fetching Hermes versions...');
|
||||
// Step 3: Get version from Hermes
|
||||
console.log('\n📥 Fetching Hermes version...');
|
||||
|
||||
const legacyHermesVersion = fetchHermesVersion(
|
||||
HERMES_LEGACY_BRANCH,
|
||||
HERMES_LEGACY_LABEL,
|
||||
);
|
||||
const v1HermesVersion = fetchHermesVersion(HERMES_V1_BRANCH, HERMES_V1_LABEL);
|
||||
const hermesVersion = fetchHermesVersion(HERMES_BRANCH, HERMES_LABEL);
|
||||
|
||||
console.log('');
|
||||
const {confirmVersions} = await inquirer.prompt({
|
||||
type: 'confirm',
|
||||
name: 'confirmVersions',
|
||||
message: `Double-check the Hermes versions above. Do you want to proceed?`,
|
||||
message: `Double-check the Hermes version above. Do you want to proceed?`,
|
||||
});
|
||||
|
||||
if (!confirmVersions) {
|
||||
@@ -119,99 +113,64 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Step 4: Create release branch in Hermes
|
||||
const releaseBranch = `release-v${legacyHermesVersion}`;
|
||||
console.log('\n🌿 Creating release branch for legacy Hermes...');
|
||||
execInRepo(`git checkout ${HERMES_LEGACY_BRANCH}`, HERMES_REPO_PATH, {
|
||||
silent: true,
|
||||
});
|
||||
// Step 4: Trigger GitHub workflow
|
||||
console.log('\n🔄 Triggering GitHub workflow...');
|
||||
|
||||
if (DRY_RUN) {
|
||||
console.log(` [DRY RUN] Would create and push branch: ${releaseBranch}`);
|
||||
} else {
|
||||
execInRepo(`git checkout -b ${releaseBranch}`, HERMES_REPO_PATH);
|
||||
execInRepo(`git push -u origin ${releaseBranch}`, HERMES_REPO_PATH);
|
||||
console.log(`✅ Created and pushed branch: ${releaseBranch}`);
|
||||
}
|
||||
|
||||
// Step 5: Trigger GitHub workflows
|
||||
console.log('\n🔄 Triggering GitHub workflows...');
|
||||
|
||||
const legacyWorkflowUrl = `https://github.com/facebook/hermes/actions/workflows/rn-build-hermes.yml?query=branch%3A${releaseBranch}`;
|
||||
const v1WorkflowUrl = `https://github.com/facebook/hermes/actions/workflows/rn-build-hermes.yml?query=branch%3A${HERMES_V1_BRANCH}`;
|
||||
const workflowUrl = `https://github.com/facebook/hermes/actions/workflows/rn-build-hermes.yml?query=branch%3A${HERMES_BRANCH}`;
|
||||
|
||||
if (DRY_RUN) {
|
||||
console.log(
|
||||
` [DRY RUN] Would trigger workflow for ${releaseBranch} with release_type=Release`,
|
||||
);
|
||||
console.log(
|
||||
` [DRY RUN] Would trigger workflow for ${HERMES_V1_BRANCH} with release_type=Release`,
|
||||
` [DRY RUN] Would trigger workflow for ${HERMES_BRANCH} with release_type=Release`,
|
||||
);
|
||||
} else {
|
||||
console.log(` Triggering workflow for ${releaseBranch}...`);
|
||||
console.log(` Triggering workflow for ${HERMES_BRANCH}...`);
|
||||
execSync(
|
||||
`gh workflow run rn-build-hermes.yml -R facebook/hermes -f branch=${releaseBranch} -f release_type=Release`,
|
||||
`gh workflow run rn-build-hermes.yml -R facebook/hermes -f branch=${HERMES_BRANCH} -f release_type=Release`,
|
||||
{stdio: 'inherit'},
|
||||
);
|
||||
console.log(` → ${legacyWorkflowUrl}`);
|
||||
console.log(` → ${workflowUrl}`);
|
||||
|
||||
console.log(` Triggering workflow for ${HERMES_V1_BRANCH}...`);
|
||||
execSync(
|
||||
`gh workflow run rn-build-hermes.yml -R facebook/hermes -f branch=${HERMES_V1_BRANCH} -f release_type=Release`,
|
||||
{stdio: 'inherit'},
|
||||
);
|
||||
console.log(` → ${v1WorkflowUrl}`);
|
||||
|
||||
console.log('✅ Workflows triggered successfully.');
|
||||
console.log('✅ Workflow triggered successfully.');
|
||||
}
|
||||
|
||||
// Step 6: Update RN repo and create commit
|
||||
// Step 5: Update RN repo and create commit
|
||||
console.log('\n⬆️ Bump Hermes version in RN release branch...');
|
||||
|
||||
if (DRY_RUN) {
|
||||
console.log(` [DRY RUN] Would set Hermes tags:`);
|
||||
console.log(` - .hermesversion: ${releaseBranch}`);
|
||||
console.log(` - .hermesv1version: ${HERMES_V1_BRANCH}`);
|
||||
console.log(` [DRY RUN] Would set Hermes tag:`);
|
||||
console.log(` - .hermesv1version: ${HERMES_BRANCH}`);
|
||||
console.log(
|
||||
` [DRY RUN] Would update hermes-compiler dependency to ${v1HermesVersion}`,
|
||||
` [DRY RUN] Would update hermes-compiler dependency to ${hermesVersion}`,
|
||||
);
|
||||
console.log(` [DRY RUN] Would update version.properties:`);
|
||||
console.log(` - HERMES_VERSION_NAME: ${v1HermesVersion}`);
|
||||
console.log(` - HERMES_VERSION_NAME: ${hermesVersion}`);
|
||||
console.log(' [DRY RUN] Would create commit: "Bump hermes version"');
|
||||
} else {
|
||||
await setHermesTag(releaseBranch, HERMES_V1_BRANCH);
|
||||
await updateHermesCompilerVersionInDependencies(v1HermesVersion);
|
||||
await updateHermesRuntimeDependenciesVersions(v1HermesVersion);
|
||||
await setHermesTag(HERMES_BRANCH);
|
||||
await updateHermesCompilerVersionInDependencies(hermesVersion);
|
||||
await updateHermesRuntimeDependenciesVersions(hermesVersion);
|
||||
execInRepo('git add .', RN_REPO_ROOT);
|
||||
execInRepo('git commit -m "Bump hermes version"', RN_REPO_ROOT);
|
||||
console.log('✅ Commit created (not pushed yet).');
|
||||
}
|
||||
|
||||
// Step 7: Bump Hermes versions for next release (PRs)
|
||||
const newLegacyVersion = createHermesBumpPR({
|
||||
currentVersion: legacyHermesVersion,
|
||||
baseBranch: HERMES_LEGACY_BRANCH,
|
||||
bumpVersion: bumpMinorVersion,
|
||||
label: HERMES_LEGACY_LABEL,
|
||||
rnBranch,
|
||||
});
|
||||
|
||||
const newV1Version = createHermesBumpPR({
|
||||
currentVersion: v1HermesVersion,
|
||||
baseBranch: HERMES_V1_BRANCH,
|
||||
// Step 6: Bump Hermes version for next release (PR)
|
||||
const newVersion = createHermesBumpPR({
|
||||
currentVersion: hermesVersion,
|
||||
baseBranch: HERMES_BRANCH,
|
||||
bumpVersion: bumpPatchVersion,
|
||||
label: HERMES_V1_LABEL,
|
||||
label: HERMES_LABEL,
|
||||
rnBranch,
|
||||
});
|
||||
|
||||
// Step 9: Bump RN main (PR)
|
||||
console.log('\n📝 Creating PR to bump Hermes V1 version on RN main...');
|
||||
const rnBumpBranch = `bump-hermes-v1-${newV1Version}`;
|
||||
// Step 7: Bump RN main (PR)
|
||||
console.log('\n📝 Creating PR to bump Hermes version on RN main...');
|
||||
const rnBumpBranch = `bump-hermes-${newVersion}`;
|
||||
|
||||
if (DRY_RUN) {
|
||||
console.log(` [DRY RUN] Would create branch ${rnBumpBranch} on RN main`);
|
||||
console.log(
|
||||
` [DRY RUN] Would update HERMES_VERSION_NAME to ${newV1Version}`,
|
||||
` [DRY RUN] Would update HERMES_VERSION_NAME to ${newVersion}`,
|
||||
);
|
||||
console.log(
|
||||
` [DRY RUN] Would create PR: "Bump hermes version for RN release ${rnBranch}" → main`,
|
||||
@@ -232,25 +191,25 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
updateVersionProperties(
|
||||
versionPropertiesPath,
|
||||
'HERMES_VERSION_NAME',
|
||||
newV1Version,
|
||||
newVersion,
|
||||
);
|
||||
execInRepo(
|
||||
'git add packages/react-native/sdks/hermes-engine/version.properties',
|
||||
RN_REPO_ROOT,
|
||||
);
|
||||
execInRepo(
|
||||
`git commit -m "Bump hermes version to ${newV1Version}"`,
|
||||
`git commit -m "Bump hermes version to ${newVersion}"`,
|
||||
RN_REPO_ROOT,
|
||||
);
|
||||
execInRepo(`git push -u origin ${rnBumpBranch}`, RN_REPO_ROOT);
|
||||
execSync(
|
||||
`gh pr create --title "Bump hermes version for RN release ${rnBranch}" --body "Bumps HERMES_VERSION_NAME to ${newV1Version} for the next release." --base main`,
|
||||
`gh pr create --title "Bump hermes version for RN release ${rnBranch}" --body "Bumps HERMES_VERSION_NAME to ${newVersion} for the next release." --base main`,
|
||||
{stdio: 'inherit', cwd: RN_REPO_ROOT},
|
||||
);
|
||||
console.log(`✅ Created PR for RN main Hermes V1 bump (${newV1Version})`);
|
||||
console.log(`✅ Created PR for RN main Hermes bump (${newVersion})`);
|
||||
}
|
||||
|
||||
// Step 10: Return to stable branch and show summary
|
||||
// Step 8: Return to stable branch and show summary
|
||||
if (!DRY_RUN) {
|
||||
execInRepo(`git checkout ${rnBranch}`, RN_REPO_ROOT, {silent: true});
|
||||
}
|
||||
@@ -259,28 +218,24 @@ async function releaseHermesForBranchCut() /*: Promise<void> */ {
|
||||
console.log(`
|
||||
✅ Dry run completed! Here's what would happen:
|
||||
|
||||
1. Create release branch: ${releaseBranch}
|
||||
2. Trigger workflows on ${releaseBranch} and ${HERMES_V1_BRANCH}
|
||||
3. Update RN repo with Hermes versions and create commit
|
||||
4. Create PR to bump Hermes legacy to ${newLegacyVersion}
|
||||
5. Create PR to bump Hermes V1 to ${newV1Version}
|
||||
6. Create PR to bump RN main HERMES_VERSION_NAME to ${newV1Version}
|
||||
1. Trigger workflow on ${HERMES_BRANCH}
|
||||
2. Update RN repo with Hermes version and create commit
|
||||
3. Create PR to bump Hermes to ${newVersion}
|
||||
4. Create PR to bump RN main HERMES_VERSION_NAME to ${newVersion}
|
||||
|
||||
Workflow URLs (when created):
|
||||
• Legacy Hermes: ${legacyWorkflowUrl}
|
||||
• Hermes V1: ${v1WorkflowUrl}
|
||||
Workflow URL (when created):
|
||||
• Hermes: ${workflowUrl}
|
||||
|
||||
⚠️ IMPORTANT: Do NOT push the RN release branch until the workflows complete.
|
||||
⚠️ IMPORTANT: Do NOT push the RN release branch until the workflow completes.
|
||||
`);
|
||||
} else {
|
||||
console.log(`
|
||||
✅ Branch cut workflow completed!
|
||||
|
||||
Monitor the workflows here:
|
||||
• Legacy Hermes: ${legacyWorkflowUrl}
|
||||
• Hermes V1: ${v1WorkflowUrl}
|
||||
Monitor the workflow here:
|
||||
• Hermes: ${workflowUrl}
|
||||
|
||||
⚠️ IMPORTANT: Do NOT push the RN release branch until the workflows complete.
|
||||
⚠️ IMPORTANT: Do NOT push the RN release branch until the workflow completes.
|
||||
`);
|
||||
}
|
||||
}
|
||||
@@ -395,13 +350,6 @@ function getHermesVersionFromPackageJson(repoPath /*: string */) /*: string */ {
|
||||
return packageJson.version;
|
||||
}
|
||||
|
||||
function bumpMinorVersion(version /*: string */) /*: string */ {
|
||||
const parts = version.split('.');
|
||||
const major = parseInt(parts[0], 10);
|
||||
const minor = parseInt(parts[1], 10);
|
||||
return `${major}.${minor + 1}.0`;
|
||||
}
|
||||
|
||||
function bumpPatchVersion(version /*: string */) /*: string */ {
|
||||
const parts = version.split('.');
|
||||
const major = parseInt(parts[0], 10);
|
||||
|
||||
@@ -32,30 +32,8 @@ const GRADLE_PROPERTIES_PATH = path.join(
|
||||
'gradle.properties',
|
||||
);
|
||||
|
||||
async function getLatestHermesNightlyVersion() /*: Promise<{
|
||||
compilerVersion: string,
|
||||
compilerV1Version: string,
|
||||
runtimeVersion: string,
|
||||
runtimeV1Version: string,
|
||||
}> */ {
|
||||
// fetch the latest commitly version of hermes v0
|
||||
const compilerVersion = await getPackageVersionStrByTag(
|
||||
'hermes-compiler',
|
||||
'nightly',
|
||||
);
|
||||
// fetch the latest version of hermes v1
|
||||
const compilerV1Version = await getPackageVersionStrByTag(
|
||||
'hermes-compiler',
|
||||
'latest-v1',
|
||||
);
|
||||
|
||||
return {
|
||||
compilerVersion,
|
||||
compilerV1Version,
|
||||
// runtime version should match the compiler version
|
||||
runtimeVersion: compilerVersion,
|
||||
runtimeV1Version: compilerV1Version,
|
||||
};
|
||||
async function getLatestHermesNightlyVersion() /*: Promise<string> */ {
|
||||
return getPackageVersionStrByTag('hermes-compiler', 'latest-v1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,17 +87,9 @@ async function updateHermesRuntimeDependenciesVersions(
|
||||
}
|
||||
|
||||
async function updateHermesVersionsToNightly() {
|
||||
const hermesVersions = await getLatestHermesNightlyVersion();
|
||||
await updateHermesCompilerVersionInDependencies(
|
||||
hermesVersions.compilerV1Version,
|
||||
);
|
||||
// Both Android Gradle and the iOS podspec now resolve Hermes from the single
|
||||
// HERMES_VERSION_NAME key, so we must write the latest-v1 value into it.
|
||||
// The legacy nightly v0 version (`runtimeVersion`) is not published to Maven
|
||||
// Central and would leave Android falling back to BUILD_FROM_GITHUB_MAIN.
|
||||
await updateHermesRuntimeDependenciesVersions(
|
||||
hermesVersions.runtimeV1Version,
|
||||
);
|
||||
const hermesVersion = await getLatestHermesNightlyVersion();
|
||||
await updateHermesCompilerVersionInDependencies(hermesVersion);
|
||||
await updateHermesRuntimeDependenciesVersions(hermesVersion);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in new issue
Block a user