-
Notifications
You must be signed in to change notification settings - Fork 36
/
update.fish
executable file
·45 lines (39 loc) · 1.69 KB
/
update.fish
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
#!/bin/fish
./scripts/compile.sh
git diff --quiet
if test $status -eq 1 -a -z "$argv[1]"
set_color --bold green
echo "Using working state..."
set_color normal
git -c color.status=always status -s | grep -E "input/[^ ]*.md"
set_color cyan
echo ------------------------------
set_color normal
git status -s | grep -E -o "input/[^ ]*.md" >/dev/null
if test $status -eq 1
echo "No md files found"
exit
end
gcloud storage cp (git status -s | grep -E -o "input/[^ ]*.md" | sed s/.md\$/.html/ | sed s/^input/output/) gs://web.evanchen.cc/ --cache-control="private,max-age=0"
# gcloud storage objects update --cache-control="private,max-age=0" (git status -s | grep -E -o "input/[^ ]*.md" | sed s/.md\$/.html/ | sed s/^input/gs:\\/\\/web.evanchen.cc/)
else
set --local commit "$argv[1]"
if test -z "$commit"
set commit HEAD
end
set_color --bold green
echo "Using commit" "$commit"
set_color normal
git show $commit --format="" --name-only --color=always \
| grep -E -e "input/[^ ]*.md"
set_color cyan
echo ------------------------------
set_color normal
git show $commit --format="" --name-only | grep -E "input/[^ ]*.md" >/dev/null
if test $status -eq 1
echo "No md files found"
else
gcloud storage cp (git show $commit --format="" --name-only | grep -E -o "input/[^ ]*.md" | sed s/.md\$/.html/ | sed s/^input/output/) gs://web.evanchen.cc/ --cache-control="private,max-age=0"
# gcloud storage objects update --cache-control="private,max-age=0" (git show $commit --format="" | grep -E -o "input/[^ ]*.md" | sed s/.md\$/.html/ | sed s/^input/gs:\\/\\/web.evanchen.cc/)
end
end