-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeploy
executable file
·34 lines (29 loc) · 1.03 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
#!/bin/bash
: ${upstream:=origin}
: ${publication:=gh-pages}
: ${development:=ctf}
REPO=`git config --get remote.$upstream.url`
MERGED=`git rev-parse $upstream/$publication^2`
CURRENT=`git rev-parse $upstream/$development`
git fetch $upstream
echo "==============================================="
echo "upstream is $upstream"
echo "works on $REPO"
echo "$MERGED is last parent of $upstream/$publication"
echo "$CURRENT is current $upstream/$development"
echo "==============================================="
if [[ $MERGED != $CURRENT ]]; then
mv dist dist-new
git clone $REPO --depth 1 -b $publication dist
rsync -av dist-new/ dist/
cd dist
git status
if [[ -z `git diff --shortstat` ]]; then echo "no diff. abort."; exit; fi
git fetch --depth 1 $upstream $development:$development
git add -A .
git reset --hard $(git commit-tree `git write-tree` -p `git rev-parse $publication` -p `git rev-parse $development` -m "regen for `git rev-parse $development`")
git push $upstream $publication
cd ..
else
echo "up to date"
fi