From 94abcffe2fdec3360ad44d70de67bcdd995beb6d Mon Sep 17 00:00:00 2001 From: Luna Wei Date: Tue, 30 Nov 2021 16:48:47 -0800 Subject: [PATCH] Update CircleCI to auto-deploy release branch on push Summary: Changelog: [Internal] Update CircleCI to auto-deploy release branch on push This work is part of an effort to automate the release process by using a push to a release branch as a trigger to prepare, package and deploy react-native to npm from CircleCI The following diagram describes the context (what kind of releases we do, relevant scripts and what they do), the pre-existing process for the different types of release and how I've modified the process. {F683387103} This diff updates the relevant CircleCI workflows Reviewed By: sota000 Differential Revision: D32702420 fbshipit-source-id: e20cdeb53eb4a8ce7e54e083e3e14bd89e11b789 --- .circleci/config.yml | 21 ++++++++++++++++++++- scripts/publish-npm.js | 4 +--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8558724dbef..1e36e241d8f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -749,6 +749,17 @@ jobs: # ------------------------- # JOBS: Releases # ------------------------- + prepare_package_for_release: + executor: reactnativeios + steps: + - add_ssh_keys: + fingerprints: + - "1c:98:e0:3a:52:79:95:29:12:cd:b4:87:5b:41:e2:bb" + - run: + name: "Set new react-native version and commit changes" + command: | + node ./scripts/prepare-package-for-release.js + build_npm_package: parameters: publish_npm_args: @@ -847,7 +858,6 @@ workflows: only: - main - /^pull\/.*$/ - - /^(\d+)\.(\d+)-stable$/ - test_js: run_disabled_tests: false filters: @@ -915,6 +925,15 @@ workflows: releases: jobs: + # This job will trigger on pushes to release branch and commit a version tag to trigger `build_npm_package` for release + - prepare_package_for_release: + name: prepare_package_for_release + filters: + branches: + only: + - /^(\d+)\.(\d+)-stable$/ + + # This job will trigger when a version tag is pushed (by prepare_package_for_release) - build_npm_package: name: build_and_publish_npm_package context: react-native-bot diff --git a/scripts/publish-npm.js b/scripts/publish-npm.js index d965724c7b1..f0cbad2ebf4 100644 --- a/scripts/publish-npm.js +++ b/scripts/publish-npm.js @@ -116,9 +116,7 @@ if (dryRunBuild) { // For stable, pre-release releases, we manually call bump-oss-version on release branch if (nightlyBuild || dryRunBuild) { if ( - exec( - `node scripts/bump-oss-version.js --nightly --to-version ${releaseVersion}`, - ).code + exec(`node scripts/set-rn-version.js --to-version ${releaseVersion}`).code ) { echo('Failed to bump version number'); exit(1);