-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (52 loc) · 1.66 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: Deploy hexo blog
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.20.4]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Configuration environment
env:
ACTIONS_DEPLOY_KEY: ${{secrets.ACTIONS_DEPLOY_KEY}}
run: |
sudo timedatectl set-timezone "Asia/Shanghai"
mkdir -p ~/.ssh/
echo "$ACTIONS_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.name "Deepcity"
git config --global user.email "f1159472899@163.com"
# 暂不清楚为何导致git服务器部署时效果与本地不同,表现为文件消失,功能暂时由脚本代替
# - name: Install dependencies
# run: |
# npm i -g hexo-cli
# npm ci
# # 这里可能需要对主题进行npm in
# # 对githubPage进行部署
# - name: Deploy hexo
# run: |
# npm run deploy
# 对服务器进行拉取
- name: ssh remove server
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
screen -r clash
cd /usr/local/hexo/
git fetch origin
git reset --hard origin/gh-pages
git clean -fd