-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.44 KB
/
node.js.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
48
49
50
51
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps: # 构建任务的步骤,一个任务可分为多个步骤
# 步骤1 拉取仓库代码
- name: Checkout # 步骤名称
uses: actions/checkout@v2
# 步骤2 给当前服务器安装node
- name: use node
uses: actions/setup-node@v2
with:
node-version: 16 # node版本
cache: "npm"
# 步骤3 下载项目依赖
- name: install
run: npm install
# 步骤4 打包node项目
- name: build
run: npm run build # 此处是你node项目的构建脚本
# 步骤5 部署项目
- name: deploy
uses: JamesIves/[email protected]
with:
repository-name: pkjy/pkjy.github.io
# 供用户访问的github access_token 下面的变量是在准备阶段自定义的变量
token: ${{ secrets.ACCESS_TOKEN }}
# 发布到指定分支
branch: master
# 指定发布的打包后的文件
folder: dist