Skip to content

Commit 4592899

Browse files
committed
ci: migrate Yarn commands to Corepack and update Node.js setup
1 parent 98096f4 commit 4592899

2 files changed

Lines changed: 22 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- name: Get yarn cache directory path
3131
id: yarn-cache-dir-path
32-
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
32+
run: echo "dir=$(corepack yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
3333

3434
- name: Cache Yarn packages
3535
uses: actions/cache@v4
@@ -40,13 +40,13 @@ jobs:
4040
${{ runner.os }}-yarn-
4141
4242
- name: Install dependencies
43-
run: yarn install --immutable
43+
run: corepack yarn install --immutable
4444

4545
- name: Lint
46-
run: yarn lint
46+
run: corepack yarn lint
4747

4848
- name: Check formatting
49-
run: yarn prettier-check
49+
run: corepack yarn prettier-check
5050

5151
test:
5252
name: Test
@@ -65,7 +65,7 @@ jobs:
6565

6666
- name: Get yarn cache directory path
6767
id: yarn-cache-dir-path
68-
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
68+
run: echo "dir=$(corepack yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
6969

7070
- name: Cache Yarn packages
7171
uses: actions/cache@v4
@@ -76,10 +76,10 @@ jobs:
7676
${{ runner.os }}-yarn-
7777
7878
- name: Install dependencies
79-
run: yarn install --immutable
79+
run: corepack yarn install --immutable
8080

8181
- name: Run tests
82-
run: yarn test
82+
run: corepack yarn test
8383

8484
commitlint:
8585
name: Commitlint
@@ -100,7 +100,7 @@ jobs:
100100

101101
- name: Get yarn cache directory path
102102
id: yarn-cache-dir-path
103-
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
103+
run: echo "dir=$(corepack yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
104104

105105
- name: Cache Yarn packages
106106
uses: actions/cache@v4
@@ -111,10 +111,10 @@ jobs:
111111
${{ runner.os }}-yarn-
112112
113113
- name: Install dependencies
114-
run: yarn install --immutable
114+
run: corepack yarn install --immutable
115115

116116
- name: Fetch main for commitlint
117117
run: git fetch origin main --depth=1
118118

119119
- name: Run commitlint
120-
run: yarn commitlint --from origin/main
120+
run: corepack yarn commitlint --from origin/main

.github/workflows/release.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ jobs:
1313
fetch-depth: 0
1414

1515
- name: Setup Node.js
16-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@v4
1717
with:
18-
node-version: '18'
18+
node-version-file: .tool-versions
19+
20+
- name: Enable Corepack
21+
run: corepack enable
1922

2023
- name: Get yarn cache directory path
2124
id: yarn-cache-dir-path
22-
run: echo "::set-output name=dir::$(yarn cache dir)"
25+
run: echo "dir=$(corepack yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
2326

24-
- uses: actions/cache@v3
27+
- uses: actions/cache@v4
2528
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
2629
with:
2730
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -30,14 +33,14 @@ jobs:
3033
${{ runner.os }}-yarn-
3134
3235
- name: Install dependencies
33-
run: yarn install --frozen-lock-file --prefer-offline
36+
run: corepack yarn install --immutable
3437

3538
- name: Get version from package.json before release step
3639
id: initversion
37-
run: echo "::set-output name=version::$(npm run get-version --silent)"
40+
run: echo "version=$(npm run get-version --silent)" >> "$GITHUB_OUTPUT"
3841

3942
- name: Build NPM package
40-
run: yarn build
43+
run: corepack yarn build
4144

4245
- name: Release to NPM
4346
id: release
@@ -48,11 +51,11 @@ jobs:
4851
GIT_AUTHOR_EMAIL: duffel-bot-read-write@duffel.com
4952
GIT_COMMITTER_NAME: duffel-bot
5053
GIT_COMMITTER_EMAIL: duffel-bot-read-write@duffel.com
51-
run: yarn release
54+
run: corepack yarn release
5255

5356
- name: Get version from package.json after release step
5457
id: extractver
55-
run: echo "::set-output name=extractver::$(npm run get-version --silent)"
58+
run: echo "extractver=$(npm run get-version --silent)" >> "$GITHUB_OUTPUT"
5659

5760
- name: Check if package versions are different
5861
run: |

0 commit comments

Comments
 (0)