-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (90 loc) · 3.22 KB
/
main.yaml
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
name: Deploy To Github Pages
on:
# 允许手动push触发
push:
branches:
- master
# 允许外部仓库事件触发
repository_dispatch:
types:
- deploy
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 检查分支
uses: actions/checkout@master
- name: 安装node环境
uses: actions/setup-node@master
with:
node-version: "16.x"
- name: 安装pnpm
run: |
export TZ='Asia/Shanghai'
npm install [email protected] -g
- name: 安装依赖
run: |
export TZ='Asia/Shanghai'
pnpm install --prod
- name: 清除缓存
env:
CLEAN_CACHE: ${{ secrets.CLEAN_CACHE }}
if: ${{ env.CLEAN_CACHE == 'true' }}
run: |
pnpm clean:yuque-token
pnpm clean:yuque-pwd
pnpm clean:notion
pnpm clean:flowus
- name: 拉取语雀&Notion&FlowUs的文章
env:
YUQUE_TOKEN: ${{ secrets.YUQUE_TOKEN }}
YUQUE_USERNAME: ${{ secrets.YUQUE_USERNAME }}
YUQUE_PWD: ${{ secrets.YUQUE_PWD }}
YUQUE_LOGIN: ${{ secrets.YUQUE_LOGIN }}
YUQUE_REPO: ${{ secrets.YUQUE_REPO }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
COS_IMAGE_BUCKET: ${{ secrets.COS_IMAGE_BUCKET }}
COS_IMAGE_REGION: ${{ secrets.COS_IMAGE_REGION }}
FLOWUS_TABLE_PAGE_ID: ${{ secrets.FLOWUS_TABLE_PAGE_ID }}
WORDPRESS_USERNAME: ${{ secrets.WORDPRESS_USERNAME }}
WORDPRESS_PASSWORD: ${{ secrets.WORDPRESS_PASSWORD }}
WORDPRESS_ENDPOINT: ${{ secrets.WORDPRESS_ENDPOINT }}
run: |
pnpm sync:flowus
pnpm sync:yuque-token
pnpm sync:notion
pnpm sync:wordpress
# 在非国内CI/CD环境中使用语雀(账号密码)方式,例如Github Workflow
# 会导致语雀后台登录设备中出现大量美国IP,
# 目前尚不清楚语雀是否会有安全限制措施,请谨慎使用。
# 推荐本地同步时使用。
# pnpm sync:yuque-pwd
- name: 配置Git用户名邮箱
run: |
git config --global user.name "1874"
git config --global user.email "[email protected]"
- name: 提交yuque拉取的文章到GitHub仓库
run: |
echo `date +"%Y-%m-%d %H:%M:%S"` begin > time.txt
git add .
git commit -m "Refresh elog.cache.json" -a
- name: 推送文章到仓库
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: 生成静态文件
env:
YUQUE_TOKEN: ${{ secrets.YUQUE_TOKEN }}
run: |
pnpm docs:build
- name: 部署到Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.SSH_PRIVATE_KEY }}
publish_dir: docs/.vitepress/dist
external_repository: LetTTGACO/LetTTGACO.github.io
publish_branch: master
commit_message: ${{ github.event.head_commit.message }}