forked from adobe/hugo-spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish-to-gh-pages.sh
executable file
·37 lines (30 loc) · 984 Bytes
/
publish-to-gh-pages.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
#!/usr/bin/env sh
#
# Copyright 2020 Adobe
# All Rights Reserved.
#
# NOTICE: Adobe permits you to use, modify, and distribute this file in
# accordance with the terms of the Adobe license agreement accompanying
# it. If you have received this file from a source other than Adobe,
# then your use, modification, or distribution of it requires the prior
# written permission of Adobe.
#
set -e
set -x
# from root dir of this repo
MESSAGE=$(git log --format=format:%s -1)
git clone --single-branch --branch gh-pages [email protected]:reef/hugo-spectrum.git site-pages
# Remove previous version - will be regenerated
rm -rf site-pages/*
hugo -v --source="$PWD/exampleSite" --destination="$PWD/site-pages" --ignoreCache
cd site-pages
git add . -f --all
if [ -z "$(git status --porcelain)" ]; then
echo "Working directory clean, nothing to commit"
else
echo "Commit message will be $MESSAGE"
git commit -m "$MESSAGE"
git push origin gh-pages
fi
cd ..
rm -rf site-pages