-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
executable file
·39 lines (33 loc) · 1.02 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
#!/bin/bash
UpdateSvg() {
node find_svg.mjs
changes=$(git ls-files -s $(git ls-files -m) | sed -e '/^16/d' )
# let's assume any untracked files we have is something we want to add
new=$(git ls-files -o --exclude-standard)
if [ "$PULL_REQUEST" == "true" ]; then
echo "Pull request detected"
echo "Changes: $(echo \"$changes\" | wc -l) files"
elif [ -n "$changes" -o -n "$new" ]; then
echo "Changes detected"
git add -A
git commit -S -a -m "$(git status --porcelain | wc -l) files | $(git status --porcelain|awk '{print "basename " $2}'| sh | sed '{:q;N;s/\n/, /g;t q}')"
git push
else
echo "No changes detected"
fi
}
set -e
cd "$(dirname "$0")"
if [[ $1 = "force" ]]; then
echo "forcing update"
UpdateSvg
fi
preupdate="$(git submodule status)"
git submodule update --remote
postupdate="$(git submodule status)"
if [ "$preupdate" != "$postupdate" ]; then
echo "submodules updated"
UpdateSvg
else
echo "submodules not updated"
fi