File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy React App with GitHub Pages
2+
3+ on :
4+ push :
5+ branches : ["main"] # Trigger on pushes to the main branch
6+ workflow_dispatch : # Allows for manual triggering
7+
8+ permissions :
9+ contents : write
10+ pages : write
11+ id-token : write
12+
13+ concurrency :
14+ group : " pages"
15+ cancel-in-progress : false
16+
17+ jobs :
18+ # Build job
19+ build :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - name : Checkout
23+ uses : actions/checkout@v2
24+ - name : Set up Node.js
25+ uses : actions/setup-node@v3
26+ with :
27+ node-version : ' 16'
28+ - name : Install dependencies
29+ run : npm install
30+ - name : Build React app
31+ run : npm run build:react
32+ - name : Bundle the app with Webpack
33+ run : npm run build:bundle
34+ - name : Upload artifact
35+ uses : actions/upload-artifact@v3
36+ with :
37+ name : react-build
38+ path : ./build
39+
40+ # Deployment job
41+ deploy :
42+ environment :
43+ name : github-pages
44+ url : ${{ steps.deployment.outputs.page_url }}
45+ runs-on : ubuntu-latest
46+ needs : build
47+ steps :
48+ - name : Checkout
49+ uses : actions/checkout@v2
50+ - name : Deploy to GitHub Pages
51+ id : deployment
52+ uses : peaceiris/actions-gh-pages@v3
53+ with :
54+ github_token : ${{ secrets.GITHUB_TOKEN }}
55+ publish_branch : gh-pages
56+ publish_dir : ./build
57+ - name : Debug URL Output
58+ run : |
59+ echo "Deployed to GitHub Pages: ${{ steps.deployment.outputs.page_url }}"
You can’t perform that action at this time.
0 commit comments