forked from sma11black/hexo-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
53 lines (47 loc) · 1.21 KB
/
entrypoint.sh
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
#!/bin/sh
set -e
# setup ssh-private-key
mkdir -p /root/.ssh/
echo "$INPUT_DEPLOY_KEY" > /root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa
ssh-keyscan -t rsa github.com >> /root/.ssh/known_hosts
# setup deploy git account
git config --global user.name "$INPUT_USER_NAME"
git config --global user.email "$INPUT_USER_EMAIL"
# install hexo env
npm install hexo-cli -g
npm install hexo-deployer-git --save
npm install gulp-cli -g
npm install
# deployment
if [ "$INPUT_COMMIT_MSG" = "none" ]
then
hexo clean
hexo generate
if [ -n "$INPUT_GULP" ] && [ "$INPUT_GULP" = "true" ]
then
gulp
fi
hexo deploy
elif [ "$INPUT_COMMIT_MSG" = "" ] || [ "$INPUT_COMMIT_MSG" = "default" ]
then
# pull original publish repo
NODE_PATH=$NODE_PATH:$(pwd)/node_modules node /sync_deploy_history.js
hexo clean
hexo generate
if [ -n "$INPUT_GULP" ] && [ "$INPUT_GULP" = "true" ]
then
gulp
fi
hexo deploy
else
NODE_PATH=$NODE_PATH:$(pwd)/node_modules node /sync_deploy_history.js
hexo clean
hexo generate
if [ -n "$INPUT_GULP" ] && [ "$INPUT_GULP" = "true" ]
then
gulp
fi
hexo deploy -m "$INPUT_COMMIT_MSG"
fi
echo ::set-output name=notify::"Deploy complate."