Skip to content

Commit 3ea86f6

Browse files
committed
feat: 增强CI流程,添加注释和项目信息打印,提高可读性和可维护性
1 parent 4534812 commit 3ea86f6

File tree

5 files changed

+63
-32
lines changed

5 files changed

+63
-32
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,84 @@
1-
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
2-
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
1+
# 用于构建和部署Jekyll站点到GitHub Pages的工作流程示例
2+
# 工作流程名称:使用预装GitHub Pages依赖项部署Jekyll
3+
name: 使用预装GitHub Pages依赖项部署Jekyll
34

5+
# 触发条件设置
46
on:
5-
# Runs on pushes targeting the default branch
7+
# 当推送到默认分支时运行
68
push:
79
branches: ["main"]
810

9-
# Allows you to run this workflow manually from the Actions tab
11+
# 允许从Actions选项卡手动运行此工作流程
1012
workflow_dispatch:
1113

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
# 设置GITHUB_TOKEN的权限,允许部署到GitHub Pages
1315
permissions:
14-
contents: read
15-
pages: write
16-
id-token: write
16+
contents: read # 允许读取仓库内容
17+
pages: write # 允许写入GitHub Pages
18+
id-token: write # 允许写入ID令牌
1719

18-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
# 并发控制设置:只允许一个部署同时进行
21+
# 跳过排队在正在进行的运行和最新排队的运行之间的运行
22+
# 但不要取消正在进行的运行,因为我们希望这些生产部署完成
2023
concurrency:
21-
group: "pages"
22-
cancel-in-progress: false
24+
group: "pages" # 并发组名称
25+
cancel-in-progress: false # 是否取消正在进行的运行
2326

27+
# 定义工作流程中的任务
2428
jobs:
25-
# Build job
29+
# 构建任务
2630
build:
27-
runs-on: ubuntu-latest
31+
runs-on: ubuntu-latest # 运行环境:最新的Ubuntu
2832
steps:
33+
# 步骤1:检出代码
2934
- name: Checkout
3035
uses: actions/checkout@v4
36+
37+
# 步骤2:设置GitHub Pages环境
3138
- name: Setup Pages
3239
uses: actions/configure-pages@v5
40+
41+
# 步骤3:打印项目信息
3342
- name: Print Project Information
3443
run: |
35-
echo "=========================================="
36-
echo "Project: github-deploy"
37-
echo "Description: 使用github为网站提供部署服务以及部署流进程运行"
38-
echo "Website: https://dushenyan.github.io/github-deploy/"
39-
echo "Repository: https://github.com/dushenyan/github-deploy"
40-
echo "=========================================="
44+
echo "======================"
45+
echo "项目名称: github-deploy"
46+
echo "项目描述: 使用github为网站提供部署服务以及部署流进程运行"
47+
echo "网站地址: https://dushenyan.github.io/github-deploy/"
48+
echo "仓库地址: https://github.com/dushenyan/github-deploy"
49+
echo "======================="
50+
51+
# 步骤4:使用Jekyll构建站点
4152
- name: Build with Jekyll
4253
uses: actions/jekyll-build-pages@v1
4354
with:
44-
source: ./
45-
destination: ./_site
55+
source: ./ # 源代码目录
56+
destination: ./_site # 构建输出目录
57+
58+
# 步骤5:上传构建产物
4659
- name: Upload artifact
4760
uses: actions/upload-pages-artifact@v3
4861

49-
# Deployment job
62+
# 部署任务
5063
deploy:
5164
environment:
52-
name: github-pages
53-
url: ${{ steps.deployment.outputs.page_url }}
54-
runs-on: ubuntu-latest
55-
needs: build
65+
name: github-pages # 环境名称
66+
url: ${{ steps.deployment.outputs.page_url }} # 部署后的页面URL
67+
runs-on: ubuntu-latest # 运行环境:最新的Ubuntu
68+
needs: build # 此任务依赖于build任务完成
69+
70+
# 部署步骤
5671
steps:
72+
# 步骤1:部署到GitHub Pages
5773
- name: Deploy to GitHub Pages
5874
id: deployment
5975
uses: actions/deploy-pages@v4
76+
77+
# 步骤2:打印部署成功信息
6078
- name: Print Deployment Success Message
6179
run: |
62-
echo "=========================================="
63-
echo "Deployment completed successfully!"
64-
echo "Project github-deploy is now live at: ${{ steps.deployment.outputs.page_url }}"
65-
echo "Thank you for using GitHub Pages for deployment!"
66-
echo "=========================================="
80+
echo "======================"
81+
echo "部署完成!"
82+
echo "项目 github-deploy 现已上线: ${{ steps.deployment.outputs.page_url }}"
83+
echo "感谢使用 GitHub Pages 部署服务!"
84+
echo "======================"

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,22 @@
66

77
使用github为网站提供部署服务以及部署流进程运行
88

9+
保证项目仓库必须是**public**状态
10+
11+
1. 开启github pages服务
12+
![alt text](assets/image.png)
13+
14+
action服务配置文件
15+
16+
![alt text](assets/image-2.png)
17+
18+
2. 调整部署目录
19+
![alt text](assets/image-1.png)
20+
921
### 相关链接
1022

1123
- [项目地址](https://github.com/dushenyan/github-deploy)
1224
- [feather SVG库](https://feathericons.com/)
25+
- [阮一峰的网络日志](https://www.ruanyifeng.com/blog/2019/09/getting-started-with-github-actions.html)
1326

1427

assets/image-1.png

260 KB
Loading

assets/image-2.png

4.51 KB
Loading

assets/image.png

161 KB
Loading

0 commit comments

Comments
 (0)