-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
deploy
executable file
·47 lines (37 loc) · 1.04 KB
/
deploy
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
# !/usr/bin/env bash
# -*- coding: utf-8 -*-
if [ "`git status -s`" ]
then
echo "The working directory is dirty. Please commit any pending changes."
exit 1;
fi
SITE_ROOT="."
SITE_PUB_DIR="site"
SITE_CONTENT_DIR="docs"
SITE_THEME_DIR="themes"
SITE_LAYOUT_DIR="layouts"
SITE_CONFIG_FILE="config.toml"
echo "Deleting old publication"
rm -rf ${SITE_PUB_DIR}
git fetch
git worktree prune
rm -rf .git/worktrees/${SITE_PUB_DIR}
echo "Checking out gh-pages branch into public"
git worktree add ${SITE_PUB_DIR} -B gh-pages
echo "Removing existing files"
rm -rf ${SITE_PUB_DIR}/*
echo "swift.jokerhub.cn" > ${SITE_PUB_DIR}/CNAME
echo "Generating site"
hugo -s "${SITE_ROOT}" \
-e production \
--contentDir="${SITE_CONTENT_DIR}" \
--themesDir="${SITE_THEME_DIR}" \
--layoutDir="${SITE_LAYOUT_DIR}" \
--config="${SITE_CONFIG_FILE}" \
--destination="${SITE_PUB_DIR}" \
--ignoreCache=true \
echo "Updating gh-pages branch"
cd ${SITE_PUB_DIR} && git add --all && git commit -m "Publishing to gh-pages"
echo "Pushing to github"
cd -
git push -uf --all