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 : Run ts and eslint checks
1+ name : Deploy to gh-pages branch
22
33on :
44 push :
88
99permissions :
1010 contents : write
11- pages : write
12- id-token : write
1311
1412jobs :
15- deploy :
13+ deploy-on-gh-pages-branch :
1614 runs-on : ubuntu-latest
1715
1816 steps :
19- - name : Checkout code
20- uses : actions/checkout@v3
17+ - name : Checkout main branch
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
2121
2222 - name : Setup Node.js
23- uses : actions/setup-node@v3
23+ uses : actions/setup-node@v4
2424 with :
2525 node-version : 22
26-
27- - name : Install Git
28- run : sudo apt-get install git -y
26+ cache : npm
2927
3028 - name : Configure git user
3129 run : |
3230 git config user.name "github-actions[bot]"
3331 git config user.email "github-actions[bot]@users.noreply.github.com"
3432
33+ - name : Switch to gh-pages branch and merge main
34+ run : |
35+ git fetch origin gh-pages || true
36+ if git show-ref --verify --quiet refs/remotes/origin/gh-pages; then
37+ git switch -c gh-pages --track origin/gh-pages
38+ else
39+ git switch --create gh-pages
40+ fi
41+ git merge main --allow-unrelated-histories -m "Merge from main branch" || echo "Already up to date"
42+
3543 - name : Install dependencies
36- run : npm install
44+ run : npm ci
3745
38- - name : Eslint checks
46+ - name : Run ESLint
3947 run : npm run eslint
4048
41- - name : Building test
49+ - name : Build project
4250 run : npm run build
4351
52+ - name : Commit and push gh-pages
53+ run : |
54+ git add -A
55+ git commit -m "Deploy from main to gh-pages" || echo "No changes to commit"
56+ git pull --rebase origin gh-pages || echo "Nothing to rebase"
57+ git push origin gh-pages -f
You can’t perform that action at this time.
0 commit comments