forked from jelly-beam/rebar3_ex_doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·67 lines (46 loc) · 1.36 KB
/
release.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash -e
OTP_RAW_VER=$(erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell)
OTP_VER=$(echo "${OTP_RAW_VER}" | sed -r 's/\"([0-9]+)\"/\1/g' | sed 's/[^0-9]*//g')
yes_or_exit() {
while true; do
read -r -p "$1 " yn
case $yn in
[Yy][Ee][sS]) true; break ;;
[Nn][Oo]) echo "Ok, bye bye!"; exit ;;
* ) echo "Please answer 'yes' or 'no'." ;;
esac
done
}
if [ "${OTP_VER}" != "24" ]; then
echo "You are using Erlang/OTP ${OTP_VER}."
echo "However, ex_doc must be built using OTP == 24 for compatibility. Giving up..."
exit
fi
VERSION=$1
if [ "${VERSION}" == "" ]; then
echo "Error: a version argument corresponding to a tag must be supplied!"
exit
fi
mix deps.get
mix escript.build
rm -f priv/ex_doc
mkdir -p _checkouts
rm -rf _checkouts/rebar3_ex_doc
cd _checkouts
git clone https://github.com/starbelly/rebar3_ex_doc
cd rebar3_ex_doc
git checkout "v${VERSION}"
mix deps.get
mix escript.build
SIZE=$(du -ah priv/ex_doc | awk '{print $1}')
echo "Size of priv/ex_doc: $SIZE"
rebar3 ex_doc
echo
echo "Documentation has been generated for rebar3_ex_doc using rebar3_ex_doc."
echo "This should be checked before publishing."
echo
yes_or_exit "Open up the documentation?"
open doc/index.html
echo
yes_or_exit "Did everything look ok?"
rebar3 hex publish