Skip to content

fix: adjust oot-release script for stable releases #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions scripts/oot-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
'use strict';

const forEachPackage = require('./monorepo/for-each-package');
const newGithubReleaseUrl = require('./new-github-release-url');
const {applyPackageVersions, publishPackage} = require('./npm-utils');
const updateTemplatePackage = require('./update-template-package');
const {failIfTagExists} = require('./release-utils');
const updateTemplatePackage = require('./update-template-package');
const {execSync} = require('child_process');
const fs = require('fs');
const path = require('path');
const {cat, echo, exit} = require('shelljs');
const yargs = require('yargs');
const newGithubReleaseUrl = require('./new-github-release-url');

const REPO_ROOT = path.resolve(__dirname, '../');

Expand Down Expand Up @@ -94,6 +94,7 @@ function releaseOOT(
oneTimePassword,
tag = 'latest',
) {
const isNightly = tag === 'nightly';
const allPackages = getPackages();
const corePackages = Object.keys(allPackages).filter(packageName =>
packageName.startsWith('@react-native/'),
Expand All @@ -107,18 +108,34 @@ function releaseOOT(
{},
);

const visionOSPackagesVersions = visionOSPackages.reduce(
(acc, pkg) => ({...acc, [pkg]: newVersion}),
{},
);

// Update `packges/react-native` package.json and all visionOS packages
visionOSPackages.forEach(pkg => {
echo(`Setting ${pkg} version to ${newVersion} `);
setPackage(allPackages[pkg], newVersion, corePackagesVersions);
});
if (isNightly) {
visionOSPackages.forEach(pkg => {
echo(`Setting ${pkg} version to ${newVersion} `);
setPackage(allPackages[pkg], newVersion, corePackagesVersions);
});
} else {
visionOSPackages.forEach(pkg => {
echo(`Setting ${pkg} version to ${newVersion} `);
setPackage(allPackages[pkg], newVersion, visionOSPackagesVersions);
});
}

// Update template package.json
updateTemplatePackage({
'react-native': reactNativeVersion,
...corePackagesVersions,
...visionOSPackages.reduce((acc, pkg) => ({...acc, [pkg]: newVersion}), {}),
...visionOSPackagesVersions,
});

if (isNightly) {
updateTemplatePackage(corePackagesVersions);
}

echo(`Updating template and it's dependencies to ${reactNativeVersion}`);

echo('Building packages...\n');
Expand All @@ -132,9 +149,8 @@ function releaseOOT(
return;
}

const gitTag = `v${newVersion}`;
failIfTagExists(tag, 'release');

const gitTag = `v${newVersion}-visionos`;
failIfTagExists(gitTag, 'release');
// Create git tag
execSync(`git tag -a ${gitTag} -m "Release ${newVersion}"`, {
cwd: REPO_ROOT,
Expand Down