修改上线配置的Node.js版本 16->20 #3
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: 部署api前端项目 | |
# 只有master分支发生push主分支或pull_request关闭后事件时,才会触发workflow | |
on: | |
push: | |
branches: | |
# 你的主分支名 | |
- master | |
pull_request: | |
branches: | |
# 你的主分支名 | |
- master | |
types: | |
- closed | |
jobs: | |
build: | |
# runs-on 指定job任务运行所需要的虚拟机环境(必填字段) | |
runs-on: ubuntu-latest | |
steps: | |
# 获取源码 | |
- name: 迁出代码 | |
# 使用action库 actions/checkout获取源码 | |
uses: actions/checkout@v3 | |
# 安装Node10 | |
- name: 安装node.js | |
# 使用action库 actions/setup-node安装node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
# 安装依赖 | |
- name: 安装依赖 | |
run: npm install | |
# 打包 | |
- name: 打包 | |
run: npm run build | |
# 上传阿里云 | |
- name: 发布项目 | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
ARGS: "-rlgoDzvc -i --delete" | |
SOURCE: "dist/" | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
TARGET: ${{ secrets.REMOTE_TARGET }} | |
# 排除项 | |
EXCLUDE: "/dist/, /node_modules/" |