diff --git a/scripts/new-github-release-url.js b/scripts/new-github-release-url.js new file mode 100644 index 00000000000000..3292eda6b6ac63 --- /dev/null +++ b/scripts/new-github-release-url.js @@ -0,0 +1,37 @@ +function newGithubReleaseUrl(options = {}) { + let repoUrl; + if (options.repoUrl) { + repoUrl = options.repoUrl; + } else if (options.user && options.repo) { + repoUrl = `https://github.com/${options.user}/${options.repo}`; + } else { + throw new Error('You need to specify either the `repoUrl` option or both the `user` and `repo` options'); + } + + const url = new URL(`${repoUrl}/releases/new`); + + const types = [ + 'tag', + 'target', + 'title', + 'body', + 'isPrerelease', + ]; + + for (let type of types) { + const value = options[type]; + if (value === undefined) { + continue; + } + + if (type === 'isPrerelease') { + type = 'prerelease'; + } + + url.searchParams.set(type, value); + } + + return url.toString(); +} + +module.exports = newGithubReleaseUrl; diff --git a/scripts/oot-release.js b/scripts/oot-release.js index febf91e07b35d3..57e6bf12523222 100644 --- a/scripts/oot-release.js +++ b/scripts/oot-release.js @@ -9,11 +9,13 @@ const forEachPackage = require('./monorepo/for-each-package'); const {applyPackageVersions, publishPackage} = require('./npm-utils'); const updateTemplatePackage = require('./update-template-package'); +const {failIfTagExists} = require('./release-utils'); 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, '../'); @@ -130,6 +132,15 @@ function releaseOOT( return; } + const gitTag = `v${newVersion}`; + failIfTagExists(tag, 'release'); + + // Create git tag + execSync(`git tag -a ${gitTag} -m "Release ${newVersion}"`, { + cwd: REPO_ROOT, + stdio: [process.stdin, process.stdout, process.stderr], + }); + const results = visionOSPackages .map(npmPackage => { return path.join(__dirname, '..', allPackages[npmPackage]); @@ -153,6 +164,19 @@ function releaseOOT( ', ', )} to npm with version: ${newVersion}`, ); + + const releaseURL = newGithubReleaseUrl({ + tag: gitTag, + title: `Release ${newVersion}`, + repo: 'react-native-visionos', + user: 'callstack', + }); + + echo('\n\n'); + echo('-------------------------------------------\n'); + echo(`Create a new release here: ${releaseURL}\n`); + echo('-------------------------------------------'); + return exit(0); } }