-
Notifications
You must be signed in to change notification settings - Fork 118
/
deploy.sh
executable file
·47 lines (34 loc) · 923 Bytes
/
deploy.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
#!/bin/bash
function buildGHPages {
npm run generate-tocs
npm run build
}
set -e # Exit with nonzero exit code if anything fails
SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"
MINE="[email protected]:rwaldron/tc39-notes.git";
TC39="[email protected]:tc39/tc39-notes.git";
SHA=`git rev-parse --verify HEAD`
# Update masters:
# rwaldron/tc39-notes#gh-pages
git push $MINE $SOURCE_BRANCH
# tc39/tc39-notes#gh-pages
git push $TC39 $SOURCE_BRANCH
# Checkout "gh-pages"
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
# Reset
git reset --hard
# Merge master for latest content
git pull --rebase origin $SOURCE_BRANCH
# Build it!
buildGHPages
# Commit the build
git add --all .
git commit -m "Build: ${SHA}"
# Push updates to:
# rwaldron/tc39-notes#gh-pages
git push $MINE $TARGET_BRANCH -f
# tc39/tc39-notes#gh-pages
git push $TC39 $TARGET_BRANCH -f
# When done, gtfo.
git checkout $SOURCE_BRANCH