|
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 |
3 | 4 |
|
| 5 | +# 触发条件设置 |
4 | 6 | on: |
5 | | - # Runs on pushes targeting the default branch |
| 7 | + # 当推送到默认分支时运行 |
6 | 8 | push: |
7 | 9 | branches: ["main"] |
8 | 10 |
|
9 | | - # Allows you to run this workflow manually from the Actions tab |
| 11 | + # 允许从Actions选项卡手动运行此工作流程 |
10 | 12 | workflow_dispatch: |
11 | 13 |
|
12 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 14 | +# 设置GITHUB_TOKEN的权限,允许部署到GitHub Pages |
13 | 15 | permissions: |
14 | | - contents: read |
15 | | - pages: write |
16 | | - id-token: write |
| 16 | + contents: read # 允许读取仓库内容 |
| 17 | + pages: write # 允许写入GitHub Pages |
| 18 | + id-token: write # 允许写入ID令牌 |
17 | 19 |
|
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 | +# 但不要取消正在进行的运行,因为我们希望这些生产部署完成 |
20 | 23 | concurrency: |
21 | | - group: "pages" |
22 | | - cancel-in-progress: false |
| 24 | + group: "pages" # 并发组名称 |
| 25 | + cancel-in-progress: false # 是否取消正在进行的运行 |
23 | 26 |
|
| 27 | +# 定义工作流程中的任务 |
24 | 28 | jobs: |
25 | | - # Build job |
| 29 | + # 构建任务 |
26 | 30 | build: |
27 | | - runs-on: ubuntu-latest |
| 31 | + runs-on: ubuntu-latest # 运行环境:最新的Ubuntu |
28 | 32 | steps: |
| 33 | + # 步骤1:检出代码 |
29 | 34 | - name: Checkout |
30 | 35 | uses: actions/checkout@v4 |
| 36 | + |
| 37 | + # 步骤2:设置GitHub Pages环境 |
31 | 38 | - name: Setup Pages |
32 | 39 | uses: actions/configure-pages@v5 |
| 40 | + |
| 41 | + # 步骤3:打印项目信息 |
33 | 42 | - name: Print Project Information |
34 | 43 | 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构建站点 |
41 | 52 | - name: Build with Jekyll |
42 | 53 | uses: actions/jekyll-build-pages@v1 |
43 | 54 | with: |
44 | | - source: ./ |
45 | | - destination: ./_site |
| 55 | + source: ./ # 源代码目录 |
| 56 | + destination: ./_site # 构建输出目录 |
| 57 | + |
| 58 | + # 步骤5:上传构建产物 |
46 | 59 | - name: Upload artifact |
47 | 60 | uses: actions/upload-pages-artifact@v3 |
48 | 61 |
|
49 | | - # Deployment job |
| 62 | + # 部署任务 |
50 | 63 | deploy: |
51 | 64 | 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 | + # 部署步骤 |
56 | 71 | steps: |
| 72 | + # 步骤1:部署到GitHub Pages |
57 | 73 | - name: Deploy to GitHub Pages |
58 | 74 | id: deployment |
59 | 75 | uses: actions/deploy-pages@v4 |
| 76 | + |
| 77 | + # 步骤2:打印部署成功信息 |
60 | 78 | - name: Print Deployment Success Message |
61 | 79 | 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 "======================" |
0 commit comments