From 1a721eaf174c88ae7b25e73d2afacda8ec5ba643 Mon Sep 17 00:00:00 2001 From: Mai Ting Kai <53888954+tingkai-mai@users.noreply.github.com> Date: Tue, 17 Sep 2024 23:32:05 +0800 Subject: [PATCH] Update nextjs.yml --- .github/workflows/nextjs.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 4d53dfc704..d1d52747bc 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -32,15 +32,21 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "yarn" # or "npm" depending on what you use + - name: Detect package manager id: detect-package-manager run: | - if [ -f "${{ github.workspace }}/frontend/yarn.lock" ]; then + if [ -f "frontend/yarn.lock" ]; then echo "manager=yarn" >> $GITHUB_OUTPUT echo "command=install" >> $GITHUB_OUTPUT echo "runner=yarn" >> $GITHUB_OUTPUT exit 0 - elif [ -f "${{ github.workspace }}/frontend/package.json" ]; then + elif [ -f "frontend/package-lock.json" ]; then echo "manager=npm" >> $GITHUB_OUTPUT echo "command=ci" >> $GITHUB_OUTPUT echo "runner=npx --no-install" >> $GITHUB_OUTPUT @@ -50,17 +56,6 @@ jobs: exit 1 fi - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: ${{ steps.detect-package-manager.outputs.manager }} - - - name: Setup Pages - uses: actions/configure-pages@v5 - with: - static_site_generator: next - - name: Restore cache uses: actions/cache@v4 with: