feat js #6
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: | |
# push 代码的时候 哪个分支会受到影响 这里是 v1.0.0 分支 | |
branches: | |
- main # 也可以设置为 main 分支 | |
# 推送之后执行一系列的任务 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 获取代码 | |
- name: 迁出代码 | |
# 使用action库 action/checkout获取代码 | |
uses: actions/checkout@main | |
# 安装Node环境 | |
- name: Use Node.js 18.12.1 | |
uses: actions/setup-node@main | |
with: | |
node-version: "18.12.1" | |
# 安装依赖 | |
- name: 安装依赖 | |
run: npm install | |
# 打包 | |
- name: 打包 | |
run: npm run docs:build | |
# 上传到腾讯云 | |
- name: 发布到阿里云 | |
uses: easingthemes/ssh-deploy@main | |
env: | |
# 私钥 | |
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
# SCP参数 | |
ARGS: "-avzr --delete" | |
# 源目录 | |
SOURCE: ".vitepress/dist/" | |
# 服务器ip | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
# 用户 | |
REMOTE_USER: "root" | |
# 目标地址 | |
# TARGET: '/var/www/html' | |
TARGET: "/home/web" | |
# 推送信息到微信 | |
# - name: 推送信息到微信 | |
# uses: easychen/github-action-server-chan@main | |
# with: | |
# sendkey: ${{ secrets.SERVER_J }} | |
# title: '网站更新完毕' |