-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
deploy
executable file
·70 lines (55 loc) · 1.82 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env zsh
#
# Copyright (C) 2015-2018 Dyne.org Foundation
#
# Designed, written and maintained by Denis Roio <[email protected]>
#
# This source code is free software; you can redistribute it
# and/or modify it under the terms of the GNU Public License
# as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later
# version.
#
# This source code is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. Please refer to the GNU Public License for more
# details.
#
# You should have received a copy of the GNU Public License
# along with this source code; if not, write to: Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
# 02139, USA.
# full path to writedown's system
[[ -r /usr/local/writedown ]] && R=/usr/local/writedown
[[ -d writedown ]] && R=`pwd`/writedown
source $R/render source
notice "Deploy PDF to HTML on gh-pages"
[[ -r pub/${book_filename}.pdf ]] || {
error "No PDF rendering made: it's needed for conversion to html"
error "first run succesfully: ./writedown/render pdf"
error "file not found: pub/${book_filename}.pdf"
return 1
}
HEAD=$(git rev-parse HEAD)
ghHEAD=$(git rev-parse --verify gh-pages)
if [[ "$ghHEAD" = "" ]]; then
act "creating gh-pages branch"
git checkout --orphan gh-pages
git reset
else
revcheck=$(git show -q ${ghHEAD} | awk '/webnomad deploy/ { print $3 }')
[[ "$HEAD" = "$revcheck" ]] && {
warning "revision already deployed: $HEAD"
return 0
}
git checkout gh-pages
fi
cp pub/${book_filename}.pdf /tmp
pdf2htmlEX /tmp/${book_filename}.pdf
mv ${book_filename}.html index.html
git add index.html
git commit -m "webnomad deploy: ${HEAD}"
git push origin gh-pages:gh-pages
git co -f master
notice "Success"