react-native/.circleci/config.yml
Alex Hunt bb4d13e80c Switch to new release workflow as default (#43533)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43533

Switch to the new unified release workflow by default, now that this has been validated on the `0.74-stable` branch.

- Remove `--use-new-workflow` flag and remove legacy logic.
- Remove legacy `prepare_package_for_release` CI job, and use `run_new_release_workflow` -> `run_release_workflow` as new workflow condition match.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55027120

fbshipit-source-id: 7c05cdff95ac369ce6cd1201ccfc5718798c4da6
2024-03-19 07:05:03 -07:00

115 lines
3.4 KiB
YAML

version: 2.1
# this allows you to use CircleCI's dynamic configuration feature
setup: true
orbs:
continuation: circleci/continuation@1.0.0
parameters:
# Real pipelines parameters
run_release_workflow:
default: false
type: boolean
run_nightly_workflow:
default: false
type: boolean
release_version:
default: ""
type: string
release_monorepo_packages_version:
default: ""
type: string
release_tag:
default: ""
type: string
release_dry_run:
default: false
type: boolean
jobs:
choose_ci_jobs:
docker:
- image: debian:bullseye
resource_class: small
steps:
- run:
name: Install Yarn
command: |
apt update
apt install -y wget git curl jq
apt-get update
apt-get install -y ca-certificates curl gnupg
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=18
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
apt-get update
apt install -y nodejs
npm install --global yarn
- checkout
- run:
name: Yarn Install
command: yarn install
- when:
condition:
or:
- equal: [ main, << pipeline.git.branch >> ]
- matches:
pattern: /0\.[0-9]+[\.[0-9]+]?-stable/
value: << pipeline.git.branch >>
steps:
- run:
name: "[Main or Stable] Create input for config to test everything"
command: |
mkdir -p /tmp/circleci/
echo '{ "run_all": true }' > /tmp/circleci/pipeline_config.json
- when:
condition:
not:
or:
- equal: [ main, << pipeline.git.branch >> ]
- matches:
pattern: /0\.[0-9]+[\.[0-9]+]?-stable/
value: << pipeline.git.branch >>
steps:
- run:
name: "[PR Branch] Filter jobs"
command: |
if [[ -z "$CIRCLE_PULL_REQUEST" ]]; then
echo "Not in a PR. Can't filter properly outside a PR. Please open a PR so that we can run the proper CI tests."
echo "For safety, we run all the tests!"
mkdir -p /tmp/circleci/
echo '{ "run_all": true }' > /tmp/circleci/pipeline_config.json
else
PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
node ./scripts/circleci/pipeline_selection.js filter-jobs
fi
- run:
name: Create config
description: Generates a configuration on the fly, depending on the files that have been modified
command: |
node ./scripts/circleci/pipeline_selection.js create-configs
- store_artifacts:
path: .circleci/generated_config.yml
destination: generated_config.yml
- continuation/continue:
configuration_path: .circleci/generated_config.yml
# our single workflow, that triggers the setup job defined above
workflows:
always-run:
jobs:
- choose_ci_jobs:
filters:
tags:
only: /.*/