@@ -28,34 +28,33 @@ jobs:
2828 # Build job
2929 build :
3030 runs-on : ubuntu-latest
31- defaults :
32- run :
33- working-directory : ./book-lending-frontend
3431 steps :
3532 - name : Checkout
3633 uses : actions/checkout@v4
34+
3735 - name : Detect package manager
3836 id : detect-package-manager
3937 run : |
40- if [ -f "${{ github.workspace }}/yarn.lock" ]; then
38+ if [ -f "${{ github.workspace }}/book-lending-frontend/ yarn.lock" ]; then
4139 echo "manager=yarn" >> $GITHUB_OUTPUT
4240 echo "command=install" >> $GITHUB_OUTPUT
4341 echo "runner=yarn" >> $GITHUB_OUTPUT
44- exit 0
45- elif [ -f "${{ github.workspace }}/package.json" ]; then
42+ elif [ -f "${{ github.workspace }}/book-lending-frontend/package.json" ]; then
4643 echo "manager=npm" >> $GITHUB_OUTPUT
4744 echo "command=ci" >> $GITHUB_OUTPUT
4845 echo "runner=npx --no-install" >> $GITHUB_OUTPUT
49- exit 0
5046 else
5147 echo "Unable to determine package manager"
5248 exit 1
5349 fi
50+
5451 - name : Setup Node
5552 uses : actions/setup-node@v4
5653 with :
5754 node-version : " 20"
5855 cache : ${{ steps.detect-package-manager.outputs.manager }}
56+ cache-dependency-path : book-lending-frontend/package-lock.json
57+
5958 - name : Setup Pages
6059 uses : actions/configure-pages@v5
6160 with :
@@ -64,26 +63,32 @@ jobs:
6463 #
6564 # You may remove this line if you want to manage the configuration yourself.
6665 static_site_generator : next
66+
6767 - name : Restore cache
6868 uses : actions/cache@v4
6969 with :
7070 path : |
7171 .next/cache
7272 # Generate a new cache whenever packages or source files change.
73- key : ${{ runner.os }}-nextjs-${{ hashFiles('** /package-lock.json', '** /yarn.lock') }}-${{ hashFiles('** .[jt]s', '* *.[jt]sx') }}
73+ key : ${{ runner.os }}-nextjs-${{ hashFiles('book-lending-frontend /package-lock.json', 'book-lending-frontend /yarn.lock') }}-${{ hashFiles('book-lending-frontend/**/* .[jt]s', 'book-lending-frontend/**/ *.[jt]sx') }}
7474 # If source files changed but packages didn't, rebuild from a prior cache.
7575 restore-keys : |
76- ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
76+ ${{ runner.os }}-nextjs-${{ hashFiles('book-lending-frontend/package-lock.json', 'book-lending-frontend/yarn.lock') }}-
77+
7778 - name : Install dependencies
7879 run : ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
80+ working-directory : book-lending-frontend
81+
7982 - name : Build with Next.js
8083 env :
8184 NEXT_PUBLIC_API_URL : ${{ secrets.NEXT_PUBLIC_API_URL }}
8285 run : ${{ steps.detect-package-manager.outputs.runner }} next build
86+ working-directory : book-lending-frontend
87+
8388 - name : Upload artifact
8489 uses : actions/upload-pages-artifact@v3
8590 with :
86- path : . /out
91+ path : book-lending-frontend /out
8792
8893 # Deployment job
8994 deploy :
0 commit comments