🐎 ci: 更改 #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 打包应用并上传腾讯云 | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
# runs-on 指定job任务运行所需要的虚拟机环境(必填字段) | |
runs-on: ubuntu-latest | |
steps: | |
# 获取源码 | |
- name: 迁出代码 | |
# 使用action库 actions/checkout获取源码 | |
uses: actions/checkout@master | |
# 安装Node18 | |
- name: 安装node.js | |
# 使用action库 actions/setup-node安装node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.20.2 | |
- name: 下载依赖 | |
run: npm install | |
- name: 打包 | |
run: npm run build | |
- name: 上传腾讯云 | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
ARGS: "-rlgoDzvc -i --delete" | |
SOURCE: "dist" | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: "root" | |
TARGET: "/www/wwwroot" | |
- name: 运行 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: root | |
key: ${{ secrets.PRIVATE_KEY }} | |
script: | | |
cd /www/wwwroot/dist | |
pm2 reload ecosystem.config.js --env production |