Skip to content

Commit 42fcbac

Browse files
Update deploy.yml
1 parent e0334d7 commit 42fcbac

File tree

1 file changed

+40
-34
lines changed

1 file changed

+40
-34
lines changed

.github/workflows/deploy.yml

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,49 @@
1-
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
1+
name: Deploy Blog
32

43
on:
5-
# Runs on pushes targeting the default branch
4+
# 每当 push 到 master 分支时触发部署
65
push:
7-
branches: ["master"]
8-
9-
# Allows you to run this workflow manually from the Actions tab
6+
branches: [master]
7+
# 手动触发部署
108
workflow_dispatch:
119

12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13-
permissions:
14-
contents: read
15-
pages: write
16-
id-token: write
17-
18-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20-
concurrency:
21-
group: "pages"
22-
cancel-in-progress: false
23-
2410
jobs:
25-
# Single deploy job since we're just deploying
26-
deploy:
27-
environment:
28-
name: github-pages
29-
url: ${{ steps.deployment.outputs.page_url }}
11+
docs:
3012
runs-on: ubuntu-latest
13+
3114
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
- name: Setup Pages
35-
uses: actions/configure-pages@v5
36-
- name: Upload artifact
37-
uses: actions/upload-pages-artifact@v3
15+
- uses: actions/checkout@v4
16+
with:
17+
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
18+
fetch-depth: 0
19+
20+
- name: 设置 pnpm
21+
uses: pnpm/action-setup@v4
22+
23+
- name: 设置 Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
# 选择要使用的 node 版本
27+
node-version: 22
28+
# 缓存 pnpm 依赖
29+
cache: pnpm
30+
31+
- name: 安装依赖
32+
run: pnpm install --frozen-lockfile
33+
34+
# 运行构建脚本
35+
- name: 构建 VuePress 站点
36+
run: pnpm docs:build
37+
38+
# 查看 workflow 的文档来获取更多信息
39+
# @see https://github.com/crazy-max/ghaction-github-pages
40+
- name: 部署到 GitHub Pages
41+
uses: crazy-max/ghaction-github-pages@v4
3842
with:
39-
# Upload entire repository
40-
path: '.'
41-
- name: Deploy to GitHub Pages
42-
id: deployment
43-
uses: actions/deploy-pages@v4
43+
# 部署到 gh-pages 分支
44+
target_branch: gh-pages
45+
# 部署目录为 VuePress 的默认输出目录
46+
build_dir: src/.vuepress/dist
47+
env:
48+
# @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)