You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
Changelog: [Internal]
* Refactor release automation so it doesn't use intermediate tags to trigger the release workflow. Now, we POST to CircleCI's ["trigger pipeline" API](https://circleci.com/docs/api/v2/#operation/triggerPipeline)
* This does have the con of needing to give CircleCI project permission for whoever wants to run a release as you'll need a token to trigger
* See related discussion: reactwg/react-native-releases#7 (reply in thread)
Description of changes:
* Changes to config.yml allow us to use our POST data to trigger a certain workflow. There is no direct API to trigger a workflow, CircleCI only has an API to trigger pipelines, so the suggestion is to leverage conditionals: https://support.circleci.com/hc/en-us/articles/360050351292-How-to-trigger-a-workflow-via-CircleCI-API-v2
* Update `bump-oss-version` to make the api call -- the instructions for running a release are still the same: https://github.com/facebook/react-native/wiki/Release-Process#creating-0minor0-rc0
* Would be good to make this a yarn script as tido64 mentioned
* Remove unused utilities now that we don't use intermediate tags like `publish-...`
Pull Request resolved: #32937
Test Plan:
Have this on a Github branch and tried this out locally:
## Running release script
Running the bump-oss script (I had to hack it locally to be allowed to run on a non-release branch):
{F694804729}
* Link to resulting workflow: https://app.circleci.com/pipelines/github/facebook/react-native/11836 -- you can [verify that the parameters are the same as I passed](https://app.circleci.com/pipelines/github/facebook/react-native/11836/workflows/59ac0c86-5fe3-4d7a-80e9-c61129d49e9f/jobs/232388?invite=true#step-106-2)
## Other attempts triggering this workflow
Notice that when I tried to run it on an actual release-branch (0.67-stable) but because the `config.yml` changes aren't on that branch, the job faisl
| {F694804321} |
## Verifying the right workflows trigger on a regular push
* Notice that the workflows "analysis" and "test" are still triggered on push (ie, the `unless:` clause isn't messing things up)
{F694804320}
Reviewed By: sota000
Differential Revision: D33715336
Pulled By: lunaleaps
fbshipit-source-id: 82672d6d50768015bdfc9f4ea4d22aa801b84f06
Copy file name to clipboardExpand all lines: scripts/bump-oss-version.js
+67-50Lines changed: 67 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@
18
18
const{exec, exit}=require('shelljs');
19
19
constyargs=require('yargs');
20
20
constinquirer=require('inquirer');
21
+
constrequest=require('request');
22
+
21
23
const{
22
24
parseVersion,
23
25
isReleaseBranch,
@@ -29,6 +31,17 @@ let argv = yargs
29
31
alias: 'remote',
30
32
default: 'origin',
31
33
})
34
+
.option('t',{
35
+
alias: 'token',
36
+
describe:
37
+
'Your CircleCI personal API token. See https://circleci.com/docs/2.0/managing-api-tokens/#creating-a-personal-api-token to set one',
38
+
required: true,
39
+
})
40
+
.option('v',{
41
+
alias: 'to-version',
42
+
describe: 'Version you aim to release, ex. 0.67.0-rc.1, 0.66.3',
43
+
required: true,
44
+
})
32
45
.check(()=>{
33
46
constbranch=getBranchName();
34
47
exitIfNotOnReleaseBranch(branch);
@@ -57,47 +70,47 @@ function getLatestTag(versionPrefix) {
57
70
returnnull;
58
71
}
59
72
73
+
functiontriggerReleaseWorkflow(options){
74
+
returnnewPromise((resolve,reject)=>{
75
+
request(options,function(error,response,body){
76
+
if(error){
77
+
reject(error);
78
+
}else{
79
+
resolve(body);
80
+
}
81
+
});
82
+
});
83
+
}
84
+
60
85
asyncfunctionmain(){
61
86
constbranch=getBranchName();
87
+
consttoken=argv.token;
88
+
constreleaseVersion=argv.toVersion;
62
89
63
-
const{pulled}=awaitinquirer.prompt({
90
+
const{pushed}=awaitinquirer.prompt({
64
91
type: 'confirm',
65
-
name: 'pulled',
66
-
message: `You are currently on branch: ${branch}. Have you run "git pull ${argv.remote}${branch} --tags"?`,
92
+
name: 'pushed',
93
+
message: `This script will trigger a release with whatever changes are on the remote branch: ${branch}. \nMake sure you have pushed any updates remotely.`,
67
94
});
68
95
69
-
if(!pulled){
70
-
console.log(`Please run 'git pull${argv.remote}${branch} --tags'`);
96
+
if(!pushed){
97
+
console.log(`Please run 'git push${argv.remote}${branch}'`);
0 commit comments