-
Notifications
You must be signed in to change notification settings - Fork 5
60 lines (47 loc) · 1.55 KB
/
Copy pathmain.yml
File metadata and controls
60 lines (47 loc) · 1.55 KB
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
name: WakaTime DashBoard CI/CD
# 触发条件:在 push 到 source 分支后触发
on:
push:
branches:
- source
env:
TZ: Asia/Shanghai
jobs:
waka-cicd:
name: WakaDashboard build & deploy
runs-on: ubuntu-latest # 使用最新的 Ubuntu 系统作为编译部署的环境
steps:
- name: Checkout codes
uses: actions/checkout@v2
- name: Setup node
# 设置 node.js 环境
uses: actions/setup-node@v1
with:
node-version: 18
- name: Cache node modules
# 设置包缓存目录,避免每次下载
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install vite dependencies
# 下载 vite 脚手架及相关安装包
run: |
npm i vite -g
npm install
- name: Generate files
# 编译 项目 文件,BASE_DOMAIN是你个人域名的构建基础路径,如果没有,可去掉--base参数
run: |
vite build
- name: Deploy WakaTime Dashboard
env:
# Github 仓库
GITHUB_REPO: github.com/fangge/wakatime-dashboard-pro
# 将编译后的博客文件推送到指定仓库
run: |
cd ./dist && git init && git add .
git config user.name "mrfangge"
git config user.email "fangge-sun@163.com"
git add .
git commit -m "GitHub Actions Auto Builder at $(date +'%Y-%m-%d %H:%M:%S')"
git push --force --quiet "https://${{ secrets.ACCESS_TOKEN }}@$GITHUB_REPO" master:master