@@ -5,47 +5,38 @@ on: [push, pull_request]
55jobs :
66 build-frontend :
77 runs-on : ubuntu-latest
8- defaults :
9- run :
10- working-directory : client # Default folder; users can change this
118 steps :
129 - uses : actions/checkout@v4
1310 - uses : actions/setup-node@v4
1411 with :
1512 node-version : 20
1613
17- # Check if client folder exists
18- - name : Check client folder existence
19- id : check_client
14+ # Only run if client folder exists
15+ - name : Check for client folder and install dependencies
16+ if : ${{ exists('client') }}
2017 run : |
21- if [ -d "./client" ]; then
22- echo "folder_exists=true" >> $GITHUB_OUTPUT
23- else
24- echo "folder_exists=false" >> $GITHUB_OUTPUT
25- fi
18+ cd client
19+ npm install
2620
27- # Run install & build only if client folder exists
28- - name : Install dependencies
29- if : steps.check_client.outputs.folder_exists == 'true'
30- run : npm install
31-
32- - name : Run lint
33- if : steps.check_client.outputs.folder_exists == 'true'
34- run : npm run lint
21+ - name : Run lint if client folder exists
22+ if : ${{ exists('client') }}
23+ run : |
24+ cd client
25+ npm run lint
3526
36- - name : Run build
37- if : steps.check_client.outputs.folder_exists == 'true'
38- run : npm run build
27+ - name : Run build if client folder exists
28+ if : ${{ exists('client') }}
29+ run : |
30+ cd client
31+ npm run build
3932
4033 deploy-vercel :
4134 runs-on : ubuntu-latest
4235 needs : build-frontend
43- if : needs.build-frontend.outputs.folder_exists == 'true' # Deploy only if build ran
4436 steps :
45- - uses : actions/checkout@v4
4637 - uses : amondnet/vercel-action@v25
4738 with :
48- vercel-token : ${{ secrets.VERCEL_TOKEN }} # Must add in repo secrets
49- vercel-org-id : ${{ secrets.VERCEL_ORG_ID }} # Must add in repo secrets
50- vercel-project-id : ${{ secrets.VERCEL_PROJECT_ID }} # Must add in repo secrets
51- working-directory : ./client # Default, can be changed by user
39+ vercel-token : ${{ secrets.VERCEL_TOKEN }}
40+ vercel-org-id : ${{ secrets.VERCEL_ORG_ID }}
41+ vercel-project-id : ${{ secrets.VERCEL_PROJECT_ID }}
42+ working-directory : ./client
0 commit comments