-
Notifications
You must be signed in to change notification settings - Fork 3
47 lines (42 loc) · 1.13 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
# 在main分支有新的推送时自动build
name: Automatic build
on:
# 仅在推送到默认分支时运行。
push:
branches: ['main']
# 这个选项可以使你手动在 Action tab 页面触发工作流
workflow_dispatch:
# 设置权限。
permissions:
contents: write
# 允许并发
concurrency:
group: 'build'
cancel-in-progress: true
jobs:
# 单次build的工作描述
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
# 指定 Node.js 的版本为 18.16.1
node-version: 18.16.1
cache: 'npm'
- name: Install dependencies
# 使用 yarn 来安装依赖包
run: yarn install
- name: Build
# 使用 yarn 来构建项目
run: yarn build
- name: Push to repository
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b build
git add -f dist/*
git commit -m "Build output"
git push -f origin build