35 lines
1.0 KiB
YAML
35 lines
1.0 KiB
YAML
name: Build and Deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://gitea.cn/actions/checkout@v3
|
|
|
|
|
|
- name: 缓存
|
|
uses: https://gitea.cn/actions/cache@v3
|
|
id: cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
- name: Install and Build # 下载依赖 打包项目
|
|
run: |
|
|
corepack enable
|
|
yarn install
|
|
yarn build
|
|
- name: Appleboy
|
|
uses: https://gitcode.net/weixin_44697517/scp-action@v0.1.4
|
|
with:
|
|
host: ${{ secrets.USER_HOST }} # 服务器地址: xxx.xxx.xxx.xxx
|
|
username: ${{ secrets.USER_NAME }} # 服务器名字 一般是root
|
|
key: ${{ secrets.SERVER_SSH_KEY }} # 服务器连接密钥
|
|
source: './dist/' # 拷贝文件目录
|
|
target: ${{ secrets.USER_TARGET }} # 服务器目标目录
|
|
strip_components: 2 |