Skip to content

Commit 1c5e0ff

Browse files
cortinicofacebook-github-bot
authored andcommitted
Do not reset the native artifacts version to 1000.0.0 on release branches (#53817)
Summary: Pull Request resolved: #53817 What is currently happening, is that the various commits on the release branches like `0.82-stable` are resetting the version of native artifacts to `1000.0.0-<SHA>`. The reason is that during the `test-all` workflow, we pass the `dry-run` as release type. That's to prevent the various tools from calling `npm publish` and so on. The problem is that on the releases branches, the version was already set at branch cut time. Therefore, we see the version 1000.0.0 reappearing during Android E2E test in the emulator. Similary this is also affecting iOS prebuilds so I'm attempting to fix it here. Changelog: [Internal] [Changed] - Reviewed By: huntie Differential Revision: D82553599 fbshipit-source-id: 31a52e7df036e700663b3d3dd677973a7a210a30
1 parent 5b88279 commit 1c5e0ff

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

.github/actions/build-android/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ runs:
1717
- name: Install node dependencies
1818
uses: ./.github/actions/yarn-install
1919
- name: Set React Native Version
20+
# We don't want to set the version for stable branches, because this has been
21+
# already set from the 'create release' commits on the release branch.
22+
if: ${{ !endsWith(github.ref_name, '-stable') }}
2023
shell: bash
2124
run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }}
2225
- name: Setup gradle

scripts/releases-ci/publish-npm.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const {
2525
} = require('../releases/utils/release-utils');
2626
const {REPO_ROOT} = require('../shared/consts');
2727
const {getPackages} = require('../shared/monorepoUtils');
28+
const fs = require('fs');
2829
const path = require('path');
2930
const yargs = require('yargs');
3031

@@ -94,12 +95,24 @@ async function publishNpm(buildType /*: BuildType */) /*: Promise<void> */ {
9495
const {version, tag} = getNpmInfo(buildType);
9596

9697
// For stable releases, ci job `prepare_package_for_release` handles this
97-
if (['dry-run', 'nightly'].includes(buildType)) {
98-
if (buildType === 'nightly') {
99-
// Set same version for all monorepo packages
100-
await setVersion(version);
101-
await publishMonorepoPackages(tag);
102-
} else {
98+
if (buildType === 'nightly') {
99+
// Set same version for all monorepo packages
100+
await setVersion(version);
101+
await publishMonorepoPackages(tag);
102+
} else if (buildType === 'dry-run') {
103+
// Before updating React Native artifacts versions for dry-run, we check if the version has already been set.
104+
// If it has, we don't need to update the artifacts at all (at this will revert them back to 1000.0.0)
105+
// If it hasn't, we can update the native artifacts accordingly.
106+
const reactNativePackageJson = path.join(
107+
REPO_ROOT,
108+
'packages',
109+
'react-native',
110+
'package.json',
111+
);
112+
const packageJsonContent = fs.readFileSync(reactNativePackageJson, 'utf8');
113+
const packageJson = JSON.parse(packageJsonContent);
114+
115+
if (packageJson.version === '1000.0.0') {
103116
await updateReactNativeArtifacts(version, buildType);
104117
}
105118
}

0 commit comments

Comments
 (0)