更新文档 #11
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: push自动更新 | |
on: | |
push: | |
branches: | |
- main | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🚀 检查代码 | |
uses: actions/checkout@v2 | |
- name: 🐧 配置环境 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: 🛠️ Build | |
run: | | |
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 }} | |
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 |