-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Version release script #6625
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
Closed
Closed
Version release script #6625
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a4f1dde
started working on it
bestander d138d8e
improving
bestander 9f60809
progressing
bestander 868cf35
progress
bestander e64845c
finished script
bestander 697300e
updated docs fore releasing
bestander 3708583
comments from Dave
bestander File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
VERSION_NAME=0.12.0-SNAPSHOT | ||
VERSION_NAME=0.0.1-master | ||
GROUP=com.facebook.react | ||
|
||
POM_NAME=ReactNative | ||
|
This file contains hidden or 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 hidden or 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) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
'use strict'; | ||
|
||
/** | ||
* This script bumps a new version for open source releases. | ||
* It updates the version in podspec/json/gradle files and makes sure they are consistent between each other | ||
* After changing the files it makes a commit and tags it. | ||
* All you have to do is push changes to remote and CI will make a new build. | ||
*/ | ||
/*eslint-disable no-undef */ | ||
require(`shelljs/global`); | ||
|
||
// - check we are in release branch, e.g. 0.33-stable | ||
let branch = exec(`git symbolic-ref --short HEAD`, {silent: true}).stdout.trim(); | ||
|
||
if (branch.indexOf(`-stable`) === -1) { | ||
echo(`You must be in 0.XX-stable branch to bump a version`); | ||
exit(1); | ||
} | ||
|
||
// e.g. 0.33 | ||
let versionMajor = branch.slice(0, branch.indexOf(`-stable`)); | ||
|
||
// - check that argument version matches branch | ||
// e.g. 0.33.1 or 0.33.0-rc4 | ||
let version = process.argv[2]; | ||
if (!version || version.indexOf(versionMajor) !== 0) { | ||
echo(`You must pass a tag like ${versionMajor}.[X]-rc[Y] to bump a version`); | ||
exit(1); | ||
} | ||
|
||
let packageJson = JSON.parse(cat(`package.json`)); | ||
packageJson.version = version; | ||
JSON.stringify(packageJson, null, 2).to(`package.json`); | ||
|
||
// - change ReactAndroid/gradle.properties | ||
if (sed(`-i`, /^VERSION_NAME=.*/, `VERSION_NAME=${version}`, `ReactAndroid/gradle.properties`).code) { | ||
echo(`Couldn't update version for Gradle`); | ||
exit(1); | ||
} | ||
|
||
// - change React.podspec | ||
if (sed(`-i`, /s.version\s*=.*/, `s.version = \"${version}\"`, `React.podspec`).code) { | ||
echo(`Couldn't update version for React.podspec`); | ||
exit(1); | ||
} | ||
|
||
// verify that files changed, we just do a git diff and check how many times version is added across files | ||
let numberOfChangedLinesWithNewVersion = exec(`git diff -U0 | grep '^[+]' | grep -c ${version} `, {silent: true}) | ||
.stdout.trim(); | ||
if (+numberOfChangedLinesWithNewVersion !== 3) { | ||
echo(`Failed to update all the files. React.podspec, package.json and gradle.properties must have versions in them`); | ||
echo(`Fix the issue, revert and try again`); | ||
exec(`git diff`); | ||
exit(1); | ||
} | ||
|
||
// - make commit [0.21.0-rc] Bump version numbers | ||
if (exec(`git commit -a -m "[${version}] Bump version numbers"`).code) { | ||
echo(`failed to commit`); | ||
exit(1); | ||
} | ||
|
||
// - add tag v0.21.0-rc | ||
if (exec(`git tag v${version}`).code) { | ||
echo(`failed to tag the commit with v${version}, are you sure this release wasn't made earlier?`); | ||
echo(`You may want to rollback the last commit`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to include directions of how to do that. |
||
echo(`git reset --hard HEAD~1`); | ||
exit(1); | ||
} | ||
|
||
exit(0); | ||
/*eslint-enable no-undef */ |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why exact- instead of exact_