-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·38 lines (28 loc) · 971 Bytes
/
deploy.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
#!/bin/bash
echo "Starting deploy";
DIR="`dirname "${0}"`"
cd $DIR
# @todo Maybe add real version numbers in some other way
version=$(date +"%y%m%d_%H%M");
config="site/config.toml"
cp $config $config~
sed -i.tmp "s/version = \".*\"/version = \"$version\"/" $config || exit $?
# Checkout the git repo with the generated source code
git clone --depth=1 git@github.com:Agigen/Generated-Site.git /tmp/agigen-hugo-release
# Generate the css
sass -I sass sass/agigen.scss --style compressed > site/static/css/agigen.css
# And then generate the markup
hugo --source=site --destination=/tmp/agigen-hugo-release/site
# Add the generated source to a commit, create a tag and push it to github
cd /tmp/agigen-hugo-release
git add site
git commit -am"Release of site version $version"
git tag -a "$version" -m"Release $version of Agigen website"
git push --tags
# Cleanup
cd -
rm -rf /tmp/agigen-hugo-release
mv $config~ $config
rm $config.tmp
# And be happy
echo "Done!"