-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c63a902
commit dd17b97
Showing
7 changed files
with
115 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: prepare_release | ||
description: Prepare React Native release | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Yarn install | ||
shell: bash | ||
run: yarn install --non-interactive | ||
- name: Creating release commit | ||
shell: bash | ||
run: | | ||
node scripts/releases/create-release-commit.js \ | ||
--reactNativeVersion "${{ inputs.version }}" \ | ||
--isLatestOnNpm "${{ inputs.is_latest_on_npm }}" \ | ||
--dryRun "${{ inputs.dry_run }}" | ||
GIT_PAGER=cat git show HEAD | ||
- name: Update "latest" tag if needed | ||
shell: bash | ||
if: ${{ inputs.tag == 'latest' }} | ||
run: | | ||
git tag -d "latest" | ||
git push origin :latest | ||
git tag -a "latest" -m "latest" | ||
- name: Pushing release commit | ||
shell: bash | ||
if: ${{ inputs.dry_run == false }} | ||
run: | | ||
CURR_BRANCH="$(git branch --show-current)" | ||
git push origin "$CURR_BRANCH" --follow-tags |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* 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. | ||
* | ||
* @flow | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
|
||
const {getBranchName} = require('../scm-utils'); | ||
|
||
const yargs = require('yargs'); | ||
const {setReactNativeVersion} = require('../releases/set-rn-version'); | ||
const setVersion = require('../releases/set-version'); | ||
const {parseVersion, validateBuildType} = require('./utils/version-utils'); | ||
const {exec} = require('shelljs'); | ||
|
||
async function main() { | ||
const argv = await yargs | ||
.option('v', { | ||
alias: 'reactNativeVersion', | ||
describe: 'The new React Native version.', | ||
type: 'string', | ||
required: true, | ||
}) | ||
.option('l', { | ||
alias: 'isLatestOnNpm', | ||
describe: | ||
'Whether the version should be published as the latest version on npm.', | ||
type: 'boolean', | ||
default: false, | ||
}) | ||
.option('d', { | ||
alias: 'dryRun', | ||
description: 'Whether we should push the commit to github or not', | ||
type: 'boolean', | ||
default: true, | ||
}).argv; | ||
|
||
const buildType = 'release'; | ||
const version = argv.reactNativeVersion; | ||
const latest = argv.isLatestOnNpm; | ||
const dryRun = argv.dryRun; | ||
const branch = getBranchName(); | ||
console.info(`Running on branch: ${branch}`); | ||
|
||
console.info('Validating version', version); | ||
const {prerelease} = parseVersion(version, buildType); | ||
|
||
const npmTag = latest ? 'latest' : prerelease ? 'next' : branch; | ||
console.info('NPM tag:', npmTag); | ||
|
||
console.info('Setting version for monorepo packages'); | ||
await setVersion(version, true); // version, skip-react-native | ||
|
||
console.info('Setting React Native version'); | ||
await setReactNativeVersion(version, {}, buildType); // version, dependencyVersions, build-type | ||
|
||
if (dryRun) { | ||
console.info('Running in dry-run mode, skipping git commit'); | ||
console.info( | ||
`git commit -a -m "Release ${version}" -m "#publish-packages-to-npm&${npmTag}"`, | ||
); | ||
console.info(`git tag -a v${version} -m "v${version}"`); | ||
return; | ||
} | ||
|
||
console.info('Committing to git'); | ||
exec( | ||
`git commit -a -m "Release ${version}" -m "#publish-packages-to-npm&${npmTag}"`, | ||
); | ||
exec(`git tag -a v${version} -m "v${version}"`); | ||
} | ||
|
||
if (require.main === module) { | ||
// eslint-disable-next-line no-void | ||
void main(); | ||
} |
This file was deleted.
Oops, something went wrong.