From 6130439763c574cf2c1749818164428662c27656 Mon Sep 17 00:00:00 2001 From: David K <75791840+Flopsky@users.noreply.github.com> Date: Sun, 31 Dec 2023 03:28:33 +0100 Subject: [PATCH] Update nextjs.yml --- .github/workflows/nextjs.yml | 49 ++++++++---------------------------- 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index f3d2815..3acf263 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -32,47 +32,19 @@ jobs: steps: - 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=ci" >> $GITHUB_OUTPUT - echo "runner=npx --no-install" >> $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: Setup Pages - uses: actions/configure-pages@v4 - with: - static_site_generator: next - - name: Restore cache - uses: actions/cache@v3 - with: - path: | - .next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- - - name: Install dependencies - run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} - - name: Build and export with Next.js - run: | - npm install - npm run next build - npm run next export + node-version: "14" # adjust the version if needed + cache: "npm" + + - name: Install Dependencies + run: npm install + + - name: Build with Next.js + run: npm run build && npm run export + - name: Upload artifact uses: actions/upload-artifact@v2 with: @@ -87,5 +59,4 @@ jobs: needs: build steps: - name: Deploy to GitHub Pages - id: deployment uses: actions/deploy-pages@v4