From da2490ac290db1a6360a9dfcdff53600ad08062d Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sat, 6 Apr 2024 10:28:14 -0700 Subject: [PATCH] ci: switch Yarn to Bun * For this project, it's faster to Bun install without a cache than to restore a cache using Yarn. * For the publish workflow, we still need the `setup-node` action. It uses the npm CLI to publish the package to NPM with provenance. --- .github/workflows/ci.yml | 13 +++++-------- .github/workflows/publish-to-npm.yml | 10 ++++++++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0142de6..8d631b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,21 +17,18 @@ jobs: steps: - uses: actions/checkout@v4 - - - uses: actions/cache@v4 - id: yarn-cache + - uses: oven-sh/setup-bun@v1 with: - path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + bun-version: 1.1.3 - name: Install dependencies - run: yarn install + run: bun install --no-scripts - name: Build the library - run: yarn build + run: bun run build - name: Run unit tests - run: yarn test + run: bun test # Only trigger deploy if previous steps pass and branch is main - name: Deploy docs diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index 0703dcc..f4ad98b 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -15,16 +15,22 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 + + # The Node.js action is required to use npm. - uses: actions/setup-node@v4 with: node-version: "20.x" registry-url: "https://registry.npmjs.org" + - uses: oven-sh/setup-bun@v1 + with: + bun-version: 1.1.3 + - name: Install dependencies - run: yarn install + run: bun install --no-scripts - name: Build package - run: yarn build + run: bun run build - name: Publish package env: