From b0d111e48d2b9eb711af074b504c4b6f3bda6641 Mon Sep 17 00:00:00 2001 From: Berzan Date: Tue, 10 Oct 2023 19:34:17 +0000 Subject: [PATCH] set: `app/` as working directory --- .github/workflows/nextjs.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 55683b6..ae28c13 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -3,7 +3,9 @@ # To get started with Next.js see: https://nextjs.org/docs/getting-started # name: Deploy Next.js site to Pages - +defaults: + run: + working-directory: app on: # Runs on pushes targeting the default branch push: @@ -34,9 +36,20 @@ jobs: - name: Detect package manager id: detect-package-manager run: | - echo "manager=npm" >> $GITHUB_OUTPUT - echo "command=ci" >> $GITHUB_OUTPUT - echo "runner=npx --no-install" >> $GITHUB_OUTPUT + 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@v3 with: @@ -54,7 +67,7 @@ jobs: uses: actions/cache@v3 with: path: | - app/.next/cache + .next/cache # Generate a new cache whenever packages or source files change. key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} # If source files changed but packages didn't, rebuild from a prior cache. @@ -69,7 +82,7 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: - path: ./app/out + path: ./out # Deployment job deploy: