1
1
#! /usr/bin/env bash
2
2
3
3
# Usage:
4
- # BOT_PASS =<dotty-bot password> ./genDocs
4
+ # BOT_TOKEN =<dotty-bot password> ./genDocs
5
5
6
6
set -e
7
7
8
8
# set extended glob, needed for rm everything but x
9
9
shopt -s extglob
10
10
11
- # make sure that BOT_PASS is set
12
- if [ -z " $BOT_PASS " ]; then
13
- echo " Error: BOT_PASS env unset, unable to push without password" 1>&2
11
+ # make sure that BOT_TOKEN is set
12
+ if [ -z " $BOT_TOKEN " ]; then
13
+ echo " Error: BOT_TOKEN env unset, unable to push without password" 1>&2
14
14
exit 1
15
15
fi
16
16
29
29
# save current head for commit message in gh-pages
30
30
GIT_HEAD=$( git rev-parse HEAD)
31
31
32
+
33
+ # set up remote and github credentials
34
+ git remote add doc-remote " https://dotty-bot:$BOT_TOKEN @github.com/lampepfl/dotty-website.git"
35
+ git config user.name " dotty-bot"
36
+ git config user.email
" [email protected] "
37
+
32
38
# check out correct branch
33
- git fetch origin gh-pages: gh-pages
39
+ git fetch doc-remote gh-pages
34
40
git checkout gh-pages
35
41
36
42
# move newly generated _site dir to $PWD
@@ -45,13 +51,9 @@ mv _site/* .
45
51
# remove now empty _site dir
46
52
rm -rf _site
47
53
48
- # set github credentials
49
- git config user.name " dotty-bot"
50
- git config user.email
" [email protected] "
51
-
52
54
# add all contents of $PWD to commit
53
55
git add -A
54
56
git commit -m " Update gh-pages site for $GIT_HEAD " || echo " nothing new to commit"
55
57
56
- # push using dotty-bot to origin
57
- git push https://dotty-bot: $BOT_PASS @github.com/lampepfl/dotty.git || echo " couldn't push, since nothing was added"
58
+ # push to doc-remote
59
+ git push doc-remote || echo " couldn't push, since nothing was added"
0 commit comments