-
Notifications
You must be signed in to change notification settings - Fork 278
Expand file tree
/
Copy pathaction.yml
More file actions
58 lines (50 loc) · 1.72 KB
/
action.yml
File metadata and controls
58 lines (50 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Setup deps
description: Setup Node.js and install dependencies
inputs:
react-version:
description: React version to install (e.g., ^19.2.0)
required: false
react-native-version:
description: React Native version to install (e.g., 0.83.1)
required: false
runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: .nvmrc
- name: Cache deps
id: yarn-cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
./node_modules
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-
- name: Install deps
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
shell: bash
- name: Switch to React and React Native versions
if: inputs.react-version != '' && inputs.react-native-version != ''
run: |
RN_VERSION='${{ inputs.react-native-version }}'
RN_MINOR="${RN_VERSION#0.}"
RN_MINOR="${RN_MINOR%%.*}"
deps=(
"react@${{ inputs.react-version }}"
"@types/react@${{ inputs.react-version }}"
"react-native@${RN_VERSION}"
"@react-native/babel-preset@${RN_VERSION}"
)
if (( RN_MINOR >= 85 )); then
deps+=("@react-native/jest-preset@${RN_VERSION}")
else
yarn remove @react-native/jest-preset
fi
yarn add -D "${deps[@]}"
shell: bash