Skip to content

Commit 0519340

Browse files
authored
Update build.yml
1 parent 5aedf49 commit 0519340

File tree

1 file changed

+40
-17
lines changed

1 file changed

+40
-17
lines changed

.github/workflows/build.yml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,55 @@
1-
name: Build
1+
# 工作流的名称,如果省略,则使用当前文件名
2+
name: Auto Deploy
23

4+
# 从工作流生成的工作流运行的名称,如果省略,则使用提交时的commit信息
5+
run-name: Deploy by @${{ github.actor }}
6+
7+
# 触发部署的条件
38
on:
9+
# 每当 push 到 master 分支时触发部署
410
push:
511
branches:
612
- main
7-
pull_request:
8-
branches:
9-
- main
1013

11-
env:
12-
CI: true
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
1318

19+
# 当前流程要执行的任务,可以是多个。[my_first_job]就是一个任务
1420
jobs:
1521
build:
16-
name: Build
22+
name: build-and-deploy
1723
runs-on: ubuntu-latest
1824

1925
steps:
20-
- name: Clone Repository
21-
uses: actions/checkout@v3
22-
23-
- name: Set Node.js Version
24-
uses: actions/setup-node@v3
26+
- uses: actions/checkout@v4
27+
- uses: pnpm/action-setup@v2
28+
with:
29+
version: 6.32.9
30+
- uses: actions/setup-node@v4
2531
with:
26-
node-version: 20
32+
node-version: '20'
33+
cache: 'pnpm'
2734

28-
- name: Install Dependencies
29-
run: npm ci
35+
- name: install
36+
run: pnpm install
3037

31-
- name: Build
32-
run: npm run build
38+
- name: Run Build Script
39+
run: pnpm build
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: ./dist
45+
# Deployment job
46+
deploy:
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
runs-on: ubuntu-latest
51+
needs: build
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)