-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate.sh
executable file
·73 lines (65 loc) · 1.48 KB
/
update.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
68
69
70
71
72
73
#!/bin/bash
# Copyright 2021 Ankur Sinha
# Author: Ankur Sinha <sanjay DOT ankur AT gmail DOT com>
# File : update.sh
#
# build the planet and commit
check_git () {
if ! command -v git; then
echo "Git is required."
exit -1
else
git config user.email "neuro-sig@lists.fedoraproject.org"
git config user.name "neurofedorabot"
fi
}
refresh_repo () {
git pull --force
}
check_pluto () {
if ! command -v pluto; then
mkdir ~/bin/
gem install --user-install sqlite3 -v 1.4.2 -n ~/bin/ || exit -1
gem install --user-install activerecord -v 6.1.4.4 -n ~/bin/ || exit -1
gem install --user-install pluto rss -n ~/bin/ || exit -1
fi
}
rebuild_planet () {
~/bin/pluto build planet.ini -t neuroscience -o docs || exit -1
}
commit_update () {
git add .
git commit -m ":rocket: Regenerated"
git push -u origin master
}
usage () {
echo "update.sh: update the planet"
echo "Usage: update.sh -[lg]"
echo
echo "-g: GitHub actions build"
echo "-l: local build"
}
while getopts "lg" OPTION
do
case $OPTION in
l)
check_git
check_pluto
refresh_repo
rebuild_planet
commit_update
exit 0
;;
g)
check_git
check_pluto
rebuild_planet
commit_update
exit 0
;;
?)
usage
exit 0
;;
esac
done