-
Notifications
You must be signed in to change notification settings - Fork 422
74 lines (61 loc) · 2.05 KB
/
deploy-docs.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
name: 部署文档
on:
push:
tags:
- 'doc*'
jobs:
deploy-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: 展示版本
run: echo ${{ steps.get_version.outputs.VERSION }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: 安装 pnpm
uses: pnpm/action-setup@v2
with:
run_install: true
- name: 设置 Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: 构建文档
id: image-name
env:
NODE_OPTIONS: --max_old_space_size=4096
run: |-
pnpm docs:build
> docs/.vuepress/dist/.nojekyll
- name: 打包镜像并推送
uses: docker/build-push-action@v2
with:
context: ./docs
file: ./docs/Dockerfile
platforms: linux/amd64
push: true
tags: |
"docker.io/mereith/van-blog-website:${{ steps.get_version.outputs.VERSION }}"
- name: 部署到集群
uses: steebchen/[email protected]
with: # defaults to latest kubectl binary version
config: ${{ secrets.K8S_CONFIG_DATA }}
command: set image deployment/vanblog-doc vanblog-doc=docker.io/mereith/van-blog-website:${{ steps.get_version.outputs.VERSION }}
- name: 等待部署生效
run: sleep 300
- name: 刷新 CDN 缓存
run: |-
curl -X POST -H "Content-Type: application/json" --header 'token: ${{ secrets.CDN_REFLASH_SECRET }}' -d '{"url":"https://vanblog.mereith.com/"}' ${{ secrets.CDN_REFLASH_URL }}