Skip to content

Commit 608bc58

Browse files
update jekyll.yml
1 parent 6bb9938 commit 608bc58

1 file changed

Lines changed: 48 additions & 20 deletions

File tree

.github/workflows/jekyll.yml

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,55 @@
1-
name: Deploy Jekyll with BibTeX
1+
name: Deploy Jekyll Site
22

33
on:
44
push:
5-
branches:
6-
- main # 或者是 master,取决于你的默认分支名
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
# 设置权限,允许脚本修改 GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# 防止多次提交导致冲突
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
718

819
jobs:
9-
jekyll:
20+
# 构建任务
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: '3.1'
31+
bundler-cache: true # 自动安装 Gemfile 里的依赖
32+
33+
- name: Setup Pages
34+
uses: actions/configure-pages@v4
35+
36+
- name: Build with Jekyll
37+
# 使用 bundle exec 确保加载了 jekyll-scholar 插件
38+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
39+
env:
40+
JEKYLL_ENV: production
41+
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
45+
# 部署任务
46+
deploy:
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
1050
runs-on: ubuntu-latest
51+
needs: build
1152
steps:
12-
- uses: actions/checkout@v4
13-
14-
- name: Setup Ruby
15-
uses: ruby/setup-ruby@v1
16-
with:
17-
ruby-version: '3.1'
18-
bundler-cache: true
19-
20-
- name: Build Site
21-
run: bundle exec jekyll build
22-
23-
- name: Deploy to GitHub Pages
24-
uses: peaceiris/actions-gh-pages@v3
25-
with:
26-
github_token: ${{ secrets.GITHUB_TOKEN }}
27-
publish_dir: ./_site
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)