Skip to content

Commit 143a7c3

Browse files
Saadnajmiclaude
andcommitted
ci: install Yarn Switch in CI workflows
Yarn v6 is distributed via Yarn Switch (not Corepack/npm), so CI environments need it installed before running yarn commands. - Add composite setup-toolchain action that wraps the upstream action and installs Yarn Switch, handling Linux/macOS vs Windows differences - Update pr.yml to use the local composite action in all jobs, replacing the separate setup-toolchain + Install Yarn Switch steps - Replace corepack enable with Yarn Switch in check-changesets job - Add Yarn Switch installation to Azure Pipelines publish workflow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0d1a66a commit 143a7c3

File tree

3 files changed

+61
-15
lines changed

3 files changed

+61
-15
lines changed

.ado/azure-pipelines.publish.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ extends:
6565
version: '22.x'
6666
displayName: 'Use Node.js 22.x'
6767

68+
- script: |
69+
curl -s https://repo.yarnpkg.com/install | bash
70+
echo "##vso[task.prependpath]$(HOME)/.yarn/switch/bin"
71+
displayName: 'Install Yarn Switch'
72+
6873
- script: |
6974
yarn
7075
displayName: 'yarn install'
@@ -104,6 +109,11 @@ extends:
104109
version: '22.x'
105110
displayName: 'Use Node.js 22.x'
106111

112+
- script: |
113+
curl -s https://repo.yarnpkg.com/install | bash
114+
echo "##vso[task.prependpath]$(HOME)/.yarn/switch/bin"
115+
displayName: 'Install Yarn Switch'
116+
107117
- task: DownloadPipelineArtifact@2
108118
inputs:
109119
artifactName: packed-tarballs
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Set up toolchain
2+
description: Sets up Node.js, platform-specific tools, and Yarn Switch
3+
4+
inputs:
5+
platform:
6+
description: Target platform (android, ios, macos, windows)
7+
required: false
8+
default: ''
9+
node-version:
10+
description: Node.js version to use
11+
required: false
12+
default: '22'
13+
xcode-developer-dir:
14+
description: Path to Xcode developer directory (macOS only)
15+
required: false
16+
default: ''
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Set up toolchain
22+
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
23+
with:
24+
platform: ${{ inputs.platform }}
25+
node-version: ${{ inputs.node-version }}
26+
xcode-developer-dir: ${{ inputs.xcode-developer-dir }}
27+
28+
- name: Install Yarn Switch
29+
if: runner.os != 'Windows'
30+
shell: bash
31+
run: |
32+
curl -s https://repo.yarnpkg.com/install | bash
33+
echo "$HOME/.yarn/switch/bin" >> $GITHUB_PATH
34+
35+
- name: Install Yarn Switch (Windows)
36+
if: runner.os == 'Windows'
37+
shell: pwsh
38+
run: |
39+
curl -s https://repo.yarnpkg.com/install | bash
40+
echo "$HOME/.yarn/switch/bin" >> $env:GITHUB_PATH

.github/workflows/pr.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fetch-depth: 0
2121

2222
- name: Set up toolchain
23-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
23+
uses: ./.github/actions/setup-toolchain
2424
with:
2525
node-version: 22
2626

@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/checkout@v4
4040

4141
- name: Set up toolchain
42-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
42+
uses: ./.github/actions/setup-toolchain
4343
with:
4444
platform: android
4545
node-version: 22
@@ -69,7 +69,7 @@ jobs:
6969
uses: actions/checkout@v4
7070

7171
- name: Set up toolchain
72-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
72+
uses: ./.github/actions/setup-toolchain
7373
with:
7474
platform: macos
7575
node-version: 22
@@ -124,7 +124,7 @@ jobs:
124124
uses: actions/checkout@v4
125125

126126
- name: Set up toolchain
127-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
127+
uses: ./.github/actions/setup-toolchain
128128
with:
129129
platform: ios
130130
node-version: 22
@@ -172,7 +172,7 @@ jobs:
172172
fetch-depth: 5
173173

174174
- name: Set up toolchain
175-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
175+
uses: ./.github/actions/setup-toolchain
176176
with:
177177
platform: windows
178178
node-version: 22
@@ -228,7 +228,7 @@ jobs:
228228
uses: actions/checkout@v4
229229

230230
- name: Set up toolchain
231-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
231+
uses: ./.github/actions/setup-toolchain
232232
with:
233233
platform: windows
234234
node-version: 22
@@ -280,14 +280,10 @@ jobs:
280280
filter: blob:none
281281
fetch-depth: 0
282282

283-
- name: Setup Node.js
284-
uses: actions/setup-node@v6
283+
- name: Set up toolchain
284+
uses: ./.github/actions/setup-toolchain
285285
with:
286286
node-version: '22'
287-
cache: 'yarn'
288-
289-
- name: Enable Corepack
290-
run: corepack enable
291287

292288
- name: Install dependencies
293289
run: yarn install --immutable
@@ -306,7 +302,7 @@ jobs:
306302
uses: actions/checkout@v4
307303

308304
- name: Set up toolchain
309-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
305+
uses: ./.github/actions/setup-toolchain
310306
with:
311307
node-version: 22
312308

@@ -347,7 +343,7 @@ jobs:
347343
uses: actions/checkout@v4
348344

349345
- name: Set up toolchain
350-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
346+
uses: ./.github/actions/setup-toolchain
351347
with:
352348
node-version: 22
353349

@@ -372,7 +368,7 @@ jobs:
372368
uses: actions/checkout@v4
373369

374370
- name: Set up toolchain
375-
uses: microsoft/react-native-test-app/.github/actions/setup-toolchain@5.0.14
371+
uses: ./.github/actions/setup-toolchain
376372
with:
377373
node-version: 22
378374

0 commit comments

Comments
 (0)