-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·53 lines (43 loc) · 978 Bytes
/
Copy pathdeploy.sh
File metadata and controls
executable file
·53 lines (43 loc) · 978 Bytes
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
# save local changes
if ! git diff-files --quiet
then
LOCAL_CHANGES=true
git stash
else
LOCAL_CHANGES=false
fi
# update heroku-deploy branch
rm -rf client/build
git branch heroku-deploy
git checkout heroku-deploy
if [ -z $CI ]
then
echo local
git remote add upstream git@github.com:morejust/store.git
else
echo ci
git remote add upstream "https://$GITHUB_TOKEN@github.com/morejust/store.git"
fi
git fetch upstream
git reset --hard upstream/heroku-deploy
# take all files from master
git checkout master .
git add .
# except for the file which makes build dir ignored
git checkout heroku-deploy client/.gitignore
# build front and add to commit
npm run build-front
git add -f client/build
# commit
DATE=`date '+%Y-%m-%d %H:%M:%S'`
git commit --allow-empty -m "build heroku $DATE"
# send updates to branch
echo push
git push --set-upstream upstream heroku-deploy
# restore local state
git reset --hard
git checkout master
if $LOCAL_CHANGES
then
git stash pop
fi