react-native/.circleci/config.yml
Riccardo Cipolleschi e91fef733b Configure CircleCI for double publishing (#40785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40785

## Changelog:
[Internal] - Configure CircleCI for double publishing

Reviewed By: cortinico

Differential Revision: D49957950

fbshipit-source-id: 56b9be1b7be374af68d8340abaf06f1c58ab173e
2023-10-11 10:09:57 -07:00

102 lines
2.9 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
release_latest:
default: false
type: boolean
release_version:
default: "9999"
type: string
run_nightly_workflow:
default: false
type: boolean
run_prealpha_workflow:
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
curl -sL https://deb.nodesource.com/setup_18.x | bash -
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 fo 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 "Skipping!"
mkdir -p /tmp/circleci/
echo '{}' > /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: /.*/