forked from Evansy/MallChatWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (48 loc) · 1.41 KB
/
deploy.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
name: build and deploy MallChat
# 触发脚本的条件,develop分支push代码的时候
on:
push:
branches:
- main
# 要执行的任务
jobs:
# 任务名称
build_and_deploy:
# runs-on 指定job任务运行所需要的虚拟机环境(必填)
runs-on: ubuntu-latest
# 任务步骤
steps:
# 获取源码
- name: 迁出代码
# 使用action库 actions/checkout获取源码
uses: actions/checkout@v3 # 使用的工具
# 使用 pnpm
- name: 使用 pnpm
uses: pnpm/action-setup@v2
with:
version: 8.5.0
# 安装node
- name: 安装node.js
# 使用action库 actions/setup-node 安装node
uses: actions/setup-node@v3
with:
node-version: 16.18.1
cache: 'pnpm'
# 安装
- name: 安装依赖
run: pnpm install
# 打包
- name: 打包
run: pnpm build
# 上传打包文件到远程服务器
- name: 上传文件到远程服务器
uses: zhenyuWang/Upload-File-Action@v1.0.1
with:
username: 'root'
server: ${{ secrets.DEPLOY_SERVER_HOST }}
port: ${{ secrets.DEPLOY_SERVER_PORT }}
ssh_private_key: ${{ secrets.DEPLOY_KEY}}
# 要上传文件所在目录
local_path: './dist/*'
# 远程服务器目标路径
target_path: '/www/wwwroot/www.mallchat.cn'