Skip to content

feat(部署脚本): 添加备用仓库克隆方案 #320

feat(部署脚本): 添加备用仓库克隆方案

feat(部署脚本): 添加备用仓库克隆方案 #320

Workflow file for this run

name: Hexo Deploy
on:
push:
branches:
- main
env:
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: "20"
- name: Setup Hexo
env:
ACTION_DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh/
echo "$ACTION_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.email "[email protected]"
git config --global user.name "W1ndys"
git config --global init.defaultBranch main
npm install hexo-cli -g
npm install
- name: Deploy
run: |
hexo clean
hexo generate
hexo deploy
- name: Deploy to ECS
uses: appleboy/[email protected]
with:
host: ${{ secrets.USER_HOST }}
username: ${{ secrets.USER_NAME }}
password: ${{ secrets.USER_PASS }}
port: 22
script: |
cd /home/W1ndys/BlogTools
sh update_site.sh
timeout: 10s