From cc7e94804094e2ae71de2354f22f31125d6e7d60 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 3 Jul 2024 11:00:05 +0800 Subject: [PATCH] fix: update github action with pnpm --- .github/workflows/build.yml | 43 ++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcd5a6d..fda42c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,22 +10,40 @@ jobs: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] - steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install with: - node-version: ${{ matrix.node-version }} - - name: Yarn CLI - uses: CultureHQ/actions-yarn@v1.0.1 - - run: yarn + version: 7 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + shell: bash + run: pnpm install - name: Run linter - run: yarn lint + run: pnpm lint - name: Run next build env: @@ -37,5 +55,4 @@ jobs: NEXT_PUBLIC_GA_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GA_TRACKING_ID }} HACKMD_CHANGELOG_ID: ${{ secrets.HACKMD_CHANGELOG_ID }} - run: | - yarn build \ No newline at end of file + run: pnpm build