-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Deploy to gh-pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # 触发条件为main分支的推送 | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: Checkout gh-pages branch | ||
run: | | ||
git fetch origin gh-pages:gh-pages | ||
git checkout gh-pages | ||
- name: Copy _site to gh-pages branch | ||
run: | | ||
rm -rf * # 清空当前的 gh-pages 内容 | ||
cp -r site/_site/* . # 将 _site 文件夹中的内容复制到当前目录 | ||
- name: Commit and push changes | ||
run: | | ||
git add . | ||
git commit -m "Deploy update to gh-pages" | ||
git push origin gh-pages |