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 to GitHub Pages
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ workflow_dispatch :
8+
9+ jobs :
10+ build-and-deploy :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : write # <-- Important: allows pushing to the repo
14+
15+ steps :
16+ - name : Check out the code
17+ uses : actions/checkout@v3
18+ with :
19+ persist-credentials : false # sometimes helpful for clarity
20+
21+ - name : Use Node
22+ uses : actions/setup-node@v3
23+ with :
24+ node-version : 18
25+
26+ - name : Install dependencies
27+ run : npm install
28+
29+ - name : Build
30+ run : npm run build
31+
32+ - name : Deploy to gh-pages
33+ uses : peaceiris/actions-gh-pages@v3
34+ with :
35+ github_token : ${{ secrets.GITHUB_TOKEN }}
36+ publish_dir : ./dist
37+ publish_branch : gh-pages # Explicitly set the target branch
38+ force_orphan : true # Creates or overwrites branch if needed
39+ commit_message : " Deploy from GitHub Actions"
You can’t perform that action at this time.
0 commit comments