File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy Production Site
2+
3+ # Trigger on pushes to the main branch
4+ on :
5+ push :
6+ branches : [ "main" ]
7+
8+ jobs :
9+ build-and-deploy :
10+ runs-on : ubuntu-latest
11+ steps :
12+ # Step 1: Check out the code from the main branch
13+ - name : Checkout main
14+ uses : actions/checkout@v4
15+
16+ # Step 2: Deploy to gh-pages branch (root directory)
17+ - name : Deploy to Production
18+ uses : peaceiris/actions-gh-pages@v4
19+ with :
20+ github_token : ${{ secrets.GITHUB_TOKEN }} # Auto-generated by GitHub
21+ publish_branch : gh-pages # Branch to deploy to
22+ publish_dir : . # Directory with built files (use _site for Jekyll/Hugo)
23+ destination_dir : . # Deploy to root of gh-pages
24+ force_orphan : true # Keep gh-pages clean (only built files)
Original file line number Diff line number Diff line change 1+ name : Deploy Staging Site
2+
3+ # Trigger on pushes to the staging branch
4+ on :
5+ push :
6+ branches : [ "staging" ]
7+
8+ jobs :
9+ build-and-deploy :
10+ runs-on : ubuntu-latest
11+ steps :
12+ # Step 1: Check out the code from the staging branch
13+ - name : Checkout staging
14+ uses : actions/checkout@v4
15+
16+ # Step 2: Deploy to gh-pages branch (staging subdirectory)
17+ - name : Deploy to Staging
18+ uses : peaceiris/actions-gh-pages@v4
19+ with :
20+ github_token : ${{ secrets.GITHUB_TOKEN }}
21+ publish_branch : gh-pages
22+ publish_dir : . # Same as production (e.g., _site for generators)
23+ destination_dir : staging # Deploy to /staging in gh-pages
24+ force_orphan : false # Don’t overwrite production files in gh-pages
You can’t perform that action at this time.
0 commit comments