-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (124 loc) · 3.88 KB
/
deploy_pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Deploy Static Pages
on:
# master 分至推送时触发
push:
branches: ["master"]
# 允许从“操作”选项卡手动运行此工作流
workflow_dispatch:
# 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# 只允许一次并发部署,跳过在进行中的运行和最近排队的运行之间排队的运行。
# 但是,不要取消正在进行的运行,因为我们希望完成这些生产部署。
concurrency:
group: "pages"
cancel-in-progress: false
# 默认使用 bash
defaults:
run:
shell: bash
jobs:
# 部署 Gitee Pages
Deploy-Gitee:
runs-on: ubuntu-latest
steps:
- name: 远程部署 Gitee Pages
uses: yanglbme/gitee-pages-action@main
with:
gitee-username: [email protected]
gitee-password: ${{ secrets.GITEE_PASSWORD }}
gitee-repo: hnest/hnest
branch: master
# 编译 GitHub Pages
Build-Repo:
runs-on: ubuntu-latest
steps:
- name: 安装 Node.js v18.16.0
uses: actions/setup-node@v3
with:
node-version: "18"
- name: 安装 Hexo CLI
run: npm install -g hexo-cli
- name: 环境构建
uses: actions/checkout@v3
with:
submodules: recursive
- name: 构建 GitHub Pages
id: pages
uses: actions/configure-pages@v3
- name: 编译 Hexo 项目使用 hnest.github.io
run: hexo clean && hexo generate --config yml/hnest.github.io.yml
- name: 上传静态文件至 HNest/hnest.github.io
env:
path_name: './public'
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
run: |
cd ${{ env.path_name }}
git config --global user.name "${{ env.user_name }}"
git config --global user.email "${{ env.user_email }}"
git init
git add .
git commit -m "${{ github.event.head_commit.message }}"
git remote add origin https://${{ github.actor }}:${{ secrets.TOKEN }}@github.com/HNest/hnest.github.io
git checkout -b main
git push origin main -f
# 编译 GitHub Pages
Build-Pages:
runs-on: ubuntu-latest
steps:
- name: 安装 Node.js v18.16.0
uses: actions/setup-node@v3
with:
node-version: "18"
- name: 安装 Hexo CLI
run: npm install -g hexo-cli
- name: 环境构建
uses: actions/checkout@v3
with:
submodules: recursive
- name: 构建 GitHub Pages
id: pages
uses: actions/configure-pages@v3
- name: 编译 Hexo 项目使用 hnest.eu.org
env:
url: ${{ steps.deployment.outputs.page_url }}
run: hexo clean && hexo generate --config yml/hnest.eu.org.yml
- name: 上传静态页面
uses: actions/upload-pages-artifact@v1
with:
path: ./public
# 部署 GitHub Pages
Deploy-Pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: Build-Pages
steps:
- name: 部署 GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
# 编译 Pages 至 gh-pages
Build-Tree:
runs-on: ubuntu-latest
steps:
- name: 安装 Node.js v18.16.0
uses: actions/setup-node@v3
with:
node-version: "18"
- name: 安装 Hexo CLI
run: npm install -g hexo-cli
- name: Actions 环境构建
uses: actions/checkout@v3
with:
submodules: recursive
- name: 编译 Hexo 项目使用域名 hnest.eu.org
run: hexo generate --config yml/hnest.eu.org.yml
- name: 上传静态页面至分支 gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public