From 5f4c91740e96e90d1fe1b56d8579479a946fde6d Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Tue, 3 Dec 2024 10:05:26 +0530 Subject: [PATCH] Update nextjs.yml --- .github/workflows/nextjs.yml | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 735be82..98e04d5 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -21,43 +21,17 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Detect package manager - id: detect-package-manager - run: | - if [ -f "${{ github.workspace }}/yarn.lock" ]; then - echo "manager=yarn" >> $GITHUB_OUTPUT - echo "command=install" >> $GITHUB_OUTPUT - echo "runner=yarn" >> $GITHUB_OUTPUT - exit 0 - elif [ -f "${{ github.workspace }}/package.json" ]; then - echo "manager=npm" >> $GITHUB_OUTPUT - echo "command=install" >> $GITHUB_OUTPUT - echo "runner=npm run" >> $GITHUB_OUTPUT - exit 0 - else - echo "Unable to determine package manager" - exit 1 - fi - - name: Setup Node uses: actions/setup-node@v4 with: node-version: "20" - cache: ${{ steps.detect-package-manager.outputs.manager }} - - - name: Restore cache - uses: actions/cache@v4 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-npm-cache- + cache: npm - name: Install dependencies - run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + run: npm install - name: Build with Next.js - run: ${{ steps.detect-package-manager.outputs.runner }} next build + run: npm run build - name: Upload artifact uses: actions/upload-pages-artifact@v3