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
17
+ DOC_REMOTE=" https://github.com/lampepfl/dotty-website.git"
18
+ DOC_BRANCH=" gh-pages"
19
+
17
20
echo " Working directory: $PWD "
18
21
19
22
# this command will generate docs in $PWD/docs/_site
30
33
GIT_HEAD=$( git rev-parse HEAD)
31
34
32
35
# check out correct branch
33
- git fetch origin gh-pages:gh-pages
34
- git checkout gh-pages
36
+ git remote add doc-remote " $DOC_REMOTE "
37
+ git fetch doc-remote " $DOC_BRANCH "
38
+ git checkout " $DOC_BRANCH "
35
39
36
40
# move newly generated _site dir to $PWD
37
41
mv $PWD /docs/_site .
@@ -47,11 +51,12 @@ rm -rf _site
47
51
48
52
# set github credentials
49
53
git config user.name " dotty-bot"
50
- git config user.email
" [email protected] "
54
+ git config user.email
" [email protected] "
55
+ git config user.password " $BOT_TOKEN "
51
56
52
57
# add all contents of $PWD to commit
53
58
git add -A
54
59
git commit -m " Update gh-pages site for $GIT_HEAD " || echo " nothing new to commit"
55
60
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"
61
+ # push using dotty-bot to DOC_REMOTE
62
+ git push doc-remote || echo " couldn't push, since nothing was added"
0 commit comments