-
Notifications
You must be signed in to change notification settings - Fork 8
57 lines (50 loc) · 1.32 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
python3 update_site.py
exit 0
timeout: 10s