@@ -36,7 +36,7 @@ executors:
3636 reactnativeandroid :
3737 << : *defaults
3838 docker :
39- - image : reactnativecommunity/react-native-android:5.1
39+ - image : reactnativecommunity/react-native-android:5.2
4040 resource_class : " large"
4141 environment :
4242 - TERM : " dumb"
@@ -78,7 +78,9 @@ commands:
7878 steps :
7979 - restore_cache :
8080 keys :
81- - v4-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
81+ - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }}
82+ - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}
83+ - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}
8284 - run :
8385 name : " Yarn: Install Dependencies"
8486 command : |
@@ -90,13 +92,7 @@ commands:
9092 - save_cache :
9193 paths :
9294 - ~/.cache/yarn
93- key : v4-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
94-
95- build_codegen :
96- steps :
97- - run :
98- name : " Codegen: Build react-native-codegen package"
99- command : cd packages/react-native-codegen && yarn build
95+ key : v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }}
10096
10197 install_buck_tooling :
10298 steps :
@@ -242,7 +238,7 @@ jobs:
242238 command : |
243239 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
244240 apt update && apt install -y shellcheck jq
245- apt-get install openssl ca-certificates
241+ apt-get -y install openssl ca-certificates
246242 update-ca-certificates
247243 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
248244 apt update && apt install -y shellcheck jq
@@ -373,7 +369,6 @@ jobs:
373369 - setup_artifacts
374370 - setup_ruby
375371 - run_yarn
376- - build_codegen
377372
378373 - run : |
379374 cd packages/rn-tester
@@ -590,7 +585,8 @@ jobs:
590585 name : Setup the Android Template
591586 command : |
592587 cd template
593- sed -i 's/1000\.0\.0/file\:\.\./g' package.json
588+ # We replace the "react-native" dependency version with file:.. so we use it from source.
589+ sed -i 's/\"react-native\"\:.*/\"react-native\"\: \"file\:\.\.\"/g' package.json
594590 npm install
595591 # react-native-community/cli is needed as the Android template is referencing a .gradle file inside it.
596592 npm i @react-native-community/cli
@@ -649,10 +645,9 @@ jobs:
649645 environment :
650646 - ANDROID_HOME : " C:\\ Android\\ android-sdk"
651647 - ANDROID_NDK : " C:\\ Android\\ android-sdk\\ ndk\\ 20.1.5948944"
652- - ANDROID_BUILD_VERSION : 30
653- - ANDROID_TOOLS_VERSION : 30 .0.2
648+ - ANDROID_BUILD_VERSION : 31
649+ - ANDROID_TOOLS_VERSION : 31 .0.0
654650 - GRADLE_OPTS : -Dorg.gradle.daemon=false
655- - NDK_VERSION : 21.4.7075529
656651 steps :
657652 - checkout
658653
@@ -698,7 +693,6 @@ jobs:
698693 sdkmanager "build-tools;%ANDROID_TOOLS_VERSION%"
699694 sdkmanager "add-ons;addon-google_apis-google-23"
700695 sdkmanager "extras;android;m2repository"
701- sdkmanager "ndk;%NDK_VERSION%"
702696
703697 # -------------------------
704698 # Run Tests
@@ -749,6 +743,19 @@ jobs:
749743 # -------------------------
750744 # JOBS: Releases
751745 # -------------------------
746+ prepare_package_for_release :
747+ executor : reactnativeios
748+ steps :
749+ - checkout
750+ - run_yarn
751+ - add_ssh_keys :
752+ fingerprints :
753+ - " 1c:98:e0:3a:52:79:95:29:12:cd:b4:87:5b:41:e2:bb"
754+ - run :
755+ name : " Set new react-native version and commit changes"
756+ command : |
757+ node ./scripts/prepare-package-for-release.js
758+
752759 build_npm_package :
753760 parameters :
754761 publish_npm_args :
@@ -847,7 +854,6 @@ workflows:
847854 only :
848855 - main
849856 - /^pull\/.*$/
850- - /^(\d+)\.(\d+)-stable$/
851857 - test_js :
852858 run_disabled_tests : false
853859 filters :
@@ -915,10 +921,25 @@ workflows:
915921
916922 releases :
917923 jobs :
924+ # This job will trigger on relevant release branch pushes.
925+ # It prepares the package and triggers `build_npm_package` for release
926+ - prepare_package_for_release :
927+ name : prepare_package_for_release
928+ # Since CircleCI does not support branch AND tag filters, we manually check in job
929+ # and no-op if there is no `publish-v{version}` tag set.
930+ filters :
931+ branches :
932+ only :
933+ - /^(\d+)\.(\d+)-stable$/
934+
935+ # This job will trigger when a version tag is pushed (by prepare_package_for_release)
918936 - build_npm_package :
919937 name : build_and_publish_npm_package
920938 context : react-native-bot
921939 publish_npm_args : --release
940+ # CircleCI filters are OR-ed, with all branches triggering by default and tags excluded by default
941+ # CircleCI env-vars are only set with the branch OR tag that triggered the job, not both.
942+ # In this case, CIRCLE_BRANCH is unset, but CIRCLE_TAG is set
922943 filters :
923944 # Both of the following conditions must be included!
924945 # Ignore any commit on any branch by default.
0 commit comments