From 45928999df223233a32e4d846fd230202c9a206c Mon Sep 17 00:00:00 2001 From: igorp1 <2934495+igorp1@users.noreply.github.com> Date: Tue, 31 Mar 2026 11:51:46 +0100 Subject: [PATCH] ci: migrate Yarn commands to Corepack and update Node.js setup --- .github/workflows/ci.yml | 20 ++++++++++---------- .github/workflows/release.yml | 21 ++++++++++++--------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ff258be..797d25d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT" + run: echo "dir=$(corepack yarn config get cacheFolder)" >> "$GITHUB_OUTPUT" - name: Cache Yarn packages uses: actions/cache@v4 @@ -40,13 +40,13 @@ jobs: ${{ runner.os }}-yarn- - name: Install dependencies - run: yarn install --immutable + run: corepack yarn install --immutable - name: Lint - run: yarn lint + run: corepack yarn lint - name: Check formatting - run: yarn prettier-check + run: corepack yarn prettier-check test: name: Test @@ -65,7 +65,7 @@ jobs: - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT" + run: echo "dir=$(corepack yarn config get cacheFolder)" >> "$GITHUB_OUTPUT" - name: Cache Yarn packages uses: actions/cache@v4 @@ -76,10 +76,10 @@ jobs: ${{ runner.os }}-yarn- - name: Install dependencies - run: yarn install --immutable + run: corepack yarn install --immutable - name: Run tests - run: yarn test + run: corepack yarn test commitlint: name: Commitlint @@ -100,7 +100,7 @@ jobs: - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT" + run: echo "dir=$(corepack yarn config get cacheFolder)" >> "$GITHUB_OUTPUT" - name: Cache Yarn packages uses: actions/cache@v4 @@ -111,10 +111,10 @@ jobs: ${{ runner.os }}-yarn- - name: Install dependencies - run: yarn install --immutable + run: corepack yarn install --immutable - name: Fetch main for commitlint run: git fetch origin main --depth=1 - name: Run commitlint - run: yarn commitlint --from origin/main + run: corepack yarn commitlint --from origin/main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1bafe35c..6bb8c521 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,15 +13,18 @@ jobs: fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: '18' + node-version-file: .tool-versions + + - name: Enable Corepack + run: corepack enable - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "dir=$(corepack yarn config get cacheFolder)" >> "$GITHUB_OUTPUT" - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -30,14 +33,14 @@ jobs: ${{ runner.os }}-yarn- - name: Install dependencies - run: yarn install --frozen-lock-file --prefer-offline + run: corepack yarn install --immutable - name: Get version from package.json before release step id: initversion - run: echo "::set-output name=version::$(npm run get-version --silent)" + run: echo "version=$(npm run get-version --silent)" >> "$GITHUB_OUTPUT" - name: Build NPM package - run: yarn build + run: corepack yarn build - name: Release to NPM id: release @@ -48,11 +51,11 @@ jobs: GIT_AUTHOR_EMAIL: duffel-bot-read-write@duffel.com GIT_COMMITTER_NAME: duffel-bot GIT_COMMITTER_EMAIL: duffel-bot-read-write@duffel.com - run: yarn release + run: corepack yarn release - name: Get version from package.json after release step id: extractver - run: echo "::set-output name=extractver::$(npm run get-version --silent)" + run: echo "extractver=$(npm run get-version --silent)" >> "$GITHUB_OUTPUT" - name: Check if package versions are different run: |