Skip to content

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Msg-Lbo committed Aug 29, 2024
1 parent 7bd7777 commit 6cbad82
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
branches:
- main

env: # 设置环境变量
TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用时区时间)
env:
TZ: Asia/Shanghai

jobs:
build: # 自定义名称
build:
runs-on: ubuntu-latest
steps:
- name: 🚀 检查代码
Expand All @@ -25,14 +25,23 @@ jobs:
npm install
npm run docs:build
- name: 🛠️ Add SSH Key to known_hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: 🛠️ Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: 🚁 部署到服务器
uses: wlixcc/[email protected]
with:
username: ${{ secrets.SSH_USERNAME }} #ssh user name
port: '22' # 远程服务器ssh端口,默认22
server: ${{ secrets.SSH_HOST }} # 远程服务器IP地址
password: ${{ secrets.SSH_PASSWORD }} # 远程服务器密码
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} # 认证服务器秘钥对的私钥
local_path: '.vitepress/dist/*' # 对应我们项目打包后的静态文件路径
remote_path: ${{ secrets.WEB_PATH }} # 服务器上的路径
delete_remote_files: true # 是否删除远程服务器上的文件
username: ${{ secrets.SSH_USERNAME }}
port: '22'
server: ${{ secrets.SSH_HOST }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
local_path: '.vitepress/dist/*'
remote_path: ${{ secrets.WEB_PATH }}
delete_remote_files: true

0 comments on commit 6cbad82

Please sign in to comment.