Skip to content

Commit 365bcb8

Browse files
committed
try to fix corepack issue on windows runners
1 parent 2db20c0 commit 365bcb8

3 files changed

Lines changed: 65 additions & 5 deletions

File tree

.github/workflows/build-installers.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,19 @@ jobs:
141141
- uses: actions/checkout@v6
142142

143143
- name: Enable Corepack
144-
run: corepack enable
144+
shell: bash
145+
run: |
146+
# On Windows the runner ships Yarn 1 at a PATH location that
147+
# outranks corepack's default install dir, so setup-node@v5's
148+
# cache probe falls back to Yarn 1 and fails on
149+
# packageManager: yarn@4. Install the corepack shim alongside
150+
# any pre-existing yarn so it overrides directly.
151+
yarn_path=$(command -v yarn || true)
152+
if [ -n "$yarn_path" ]; then
153+
corepack enable --install-directory "$(dirname "$yarn_path")"
154+
else
155+
corepack enable
156+
fi
145157
146158
- name: Setup Node.js
147159
uses: actions/setup-node@v5
@@ -265,7 +277,19 @@ jobs:
265277
- uses: actions/checkout@v6
266278

267279
- name: Enable Corepack
268-
run: corepack enable
280+
shell: bash
281+
run: |
282+
# On Windows the runner ships Yarn 1 at a PATH location that
283+
# outranks corepack's default install dir, so setup-node@v5's
284+
# cache probe falls back to Yarn 1 and fails on
285+
# packageManager: yarn@4. Install the corepack shim alongside
286+
# any pre-existing yarn so it overrides directly.
287+
yarn_path=$(command -v yarn || true)
288+
if [ -n "$yarn_path" ]; then
289+
corepack enable --install-directory "$(dirname "$yarn_path")"
290+
else
291+
corepack enable
292+
fi
269293
270294
- name: Setup Node.js
271295
uses: actions/setup-node@v5

.github/workflows/publish-longtail-addon.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,19 @@ jobs:
3333
- uses: actions/checkout@v6
3434

3535
- name: Enable Corepack
36-
run: corepack enable
36+
shell: bash
37+
run: |
38+
# On Windows the runner ships Yarn 1 at a PATH location that
39+
# outranks corepack's default install dir, so setup-node@v5's
40+
# cache probe falls back to Yarn 1 and fails on
41+
# packageManager: yarn@4. Install the corepack shim alongside
42+
# any pre-existing yarn so it overrides directly.
43+
yarn_path=$(command -v yarn || true)
44+
if [ -n "$yarn_path" ]; then
45+
corepack enable --install-directory "$(dirname "$yarn_path")"
46+
else
47+
corepack enable
48+
fi
3749
3850
- uses: actions/setup-node@v5
3951
with:
@@ -101,7 +113,19 @@ jobs:
101113
- uses: actions/checkout@v6
102114

103115
- name: Enable Corepack
104-
run: corepack enable
116+
shell: bash
117+
run: |
118+
# On Windows the runner ships Yarn 1 at a PATH location that
119+
# outranks corepack's default install dir, so setup-node@v5's
120+
# cache probe falls back to Yarn 1 and fails on
121+
# packageManager: yarn@4. Install the corepack shim alongside
122+
# any pre-existing yarn so it overrides directly.
123+
yarn_path=$(command -v yarn || true)
124+
if [ -n "$yarn_path" ]; then
125+
corepack enable --install-directory "$(dirname "$yarn_path")"
126+
else
127+
corepack enable
128+
fi
105129
106130
- uses: actions/setup-node@v5
107131
with:

.github/workflows/test.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,19 @@ jobs:
2222
- uses: actions/checkout@v6
2323

2424
- name: Enable Corepack
25-
run: corepack enable
25+
shell: bash
26+
run: |
27+
# On Windows the runner ships Yarn 1 at a PATH location that
28+
# outranks corepack's default install dir, so setup-node@v5's
29+
# cache probe falls back to Yarn 1 and fails on
30+
# packageManager: yarn@4. Install the corepack shim alongside
31+
# any pre-existing yarn so it overrides directly.
32+
yarn_path=$(command -v yarn || true)
33+
if [ -n "$yarn_path" ]; then
34+
corepack enable --install-directory "$(dirname "$yarn_path")"
35+
else
36+
corepack enable
37+
fi
2638
2739
- uses: actions/setup-node@v5
2840
with:

0 commit comments

Comments
 (0)