merge dev #8
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: release | |
on: | |
# 代码 push master 分支的时候触发 | |
push: | |
branches: master | |
jobs: | |
# 定义一个job,名字为 release | |
release: | |
# 使用github提供给我们的机器去跑 | |
runs-on: ubuntu-latest | |
steps: | |
# 拉取最新的代码 | |
- name: Checkout repository | |
uses: actions/checkout@master | |
# 安装node环境 | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: "20.x" | |
# 为node_modules设置缓存 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
# 缓存文件目录的路径 | |
path: node_modules | |
key: node_modules-${{hashFiles('package-lock.json')}} | |
restore-keys: node_modules- | |
# 安装依赖 | |
- name: Installing Dependencies | |
run: npm install | |
# 打包 | |
- name: Build | |
run: npm run build | |
# 产物上传服务器 | |
- name: Upload to Deploy Server | |
uses: easingthemes/[email protected] | |
env: | |
# 免密登录的秘钥 宝塔/安全/SSH登录私钥 | |
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_PASS }} | |
# 服务器的公网IP | |
REMOTE_HOST: ${{ secrets.SERVER_HOST }} | |
# 服务器登录用户名 | |
REMOTE_USER: root | |
# 你打包后产物的文件夹 | |
SOURCE: "dist/" | |
# 先清空目标目录 | |
ARGS: "-avzr --delete" | |
# 上传到服务器目标目录 | |
TARGET: "/www/wwwroot/LegendTD" |