Skip to content

Commit 237d2a0

Browse files
authored
Create releases-demo.yml
1 parent a49c6e1 commit 237d2a0

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/releases-demo.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# 将静态内容部署到 GitHub Pages 的简易工作流程
2+
name: RELEASES DEMO
3+
4+
on:
5+
# 仅在推送到默认分支时触发工作流
6+
push:
7+
branches:
8+
- main
9+
10+
# 这个选项可以使你手动在 Action tab 页面触发工作流
11+
workflow_dispatch:
12+
13+
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
# 允许一个并发的部署
20+
concurrency:
21+
group: 'pages'
22+
cancel-in-progress: true
23+
24+
jobs:
25+
# 单次部署的工作描述
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Set up Node
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 20.x
38+
- name: Install dependencies and build
39+
run: |
40+
npm ci
41+
npm run build
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
# Upload dist folder
48+
path: '/dist'
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)