-
-
Notifications
You must be signed in to change notification settings - Fork 129
67 lines (54 loc) · 1.48 KB
/
production-deployment-to-github-pages.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
name: 构建并部署到 Github Pages
on:
workflow_dispatch:
# push:
# branches:
# - 'main'
env:
STORE_PATH: ''
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Ubuntu 构建和推送
runs-on: ubuntu-latest
environment:
name: 正式 Production - GitHub Pages
url: https://nolebase.github.io/nolebase
steps:
- name: 签出代码
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 安装 Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: 安装 pnpm
uses: pnpm/action-setup@v2
with:
run_install: false
version: 8
- name: 获取 pnpm store 目录
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: 配置 pnpm 缓存
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 安装依赖
run: pnpm install --frozen-lockfile
- name: 构建
run: pnpm docs:build
- name: 推送到 gh-pages 分支
timeout-minutes: 10
with:
token: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: .vitepress/dist
uses: JamesIves/github-pages-deploy-action@v4