-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (53 loc) · 1.45 KB
/
build.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
# 工作流名称
name: Auto Build
# 从工作流生成的工作流运行的名称,如果省略,则使用提交时的commit信息
run-name: Deploy by @${{ github.actor }}
# 触发条件
on:
push:
branches:
- master
# 工作流的步骤
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
persist-credentials: false
# 安装node
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
# 安装pnpm
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_EN
# 使用pnpm缓存可以减少安装时间
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
# 安装依赖
- name: Install dependencies and build
run: |
npm install
npm run build:prod
# 部署到gh-pages分支
- name: deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist
clean: true