55 branches :
66 - main
77
8- # Add this permissions block
98permissions :
109 contents : write
10+ pages : write
11+ id-token : write
1112
1213jobs :
1314 build :
@@ -17,25 +18,43 @@ jobs:
1718 steps :
1819 - name : Checkout repo
1920 uses : actions/checkout@v3
21+
22+ - name : Debug current location
23+ run : |
24+ pwd
25+ ls -la
26+
27+ - name : Navigate to React directory
28+ run : |
29+ cd $GITHUB_WORKSPACE/react_frontend || cd react_frontend || echo "Already in correct directory"
30+ pwd
31+ ls -la
2032
2133 - name : Setup Node
2234 uses : actions/setup-node@v3
2335 with :
24- node-version : ' 16' # Specify a Node.js version
36+ node-version : ' 16'
2537
2638 - name : Install dependencies
2739 uses : bahmutov/npm-install@v1
2840 with :
29- working-directory : . # Explicitly set working directory
41+ working-directory : react_frontend
3042
3143 - name : Build project
32- run : npm run build
44+ run : |
45+ cd $GITHUB_WORKSPACE/react_frontend || cd react_frontend
46+ npm run build
47+
48+ - name : Verify build output
49+ run : |
50+ cd $GITHUB_WORKSPACE/react_frontend || cd react_frontend
51+ ls -la dist || echo "No dist directory found!"
3352
3453 - name : Upload production-ready build files
3554 uses : actions/upload-artifact@v4
3655 with :
3756 name : production-files
38- path : . /dist
57+ path : react_frontend /dist
3958
4059 deploy :
4160 name : Deploy
@@ -44,14 +63,22 @@ jobs:
4463 if : github.ref == 'refs/heads/main'
4564
4665 steps :
66+ - name : Checkout repo for deployment
67+ uses : actions/checkout@v3
68+
4769 - name : Download artifact
4870 uses : actions/download-artifact@v4
4971 with :
5072 name : production-files
51- path : ./dist
73+ path : ./deploy-dist
74+
75+ - name : Verify download
76+ run : |
77+ ls -la ./deploy-dist
5278
5379 - name : Deploy to GitHub Pages
5480 uses : peaceiris/actions-gh-pages@v3
5581 with :
5682 github_token : ${{ secrets.GITHUB_TOKEN }}
57- publish_dir : ./dist
83+ publish_dir : ./deploy-dist
84+ force_orphan : true
0 commit comments