Skip to content

Commit c176153

Browse files
committed
Fix #5248: Move generated doc to lampepfl/dotty-website
1 parent 2dd964d commit c176153

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.drone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pipeline:
5252
image: lampepfl/dotty:2018-10-01
5353
commands:
5454
- ./project/scripts/genDocs
55-
secrets: [ bot_pass ]
55+
secrets: [ bot_token ]
5656
when:
5757
event: push
5858
# We only generate the documentation for the master branch

project/scripts/genDocs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
#!/usr/bin/env bash
22

33
# Usage:
4-
# BOT_PASS=<dotty-bot password> ./genDocs
4+
# BOT_TOKEN=<dotty-bot password> ./genDocs
55

66
set -e
77

88
# set extended glob, needed for rm everything but x
99
shopt -s extglob
1010

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
1414
exit 1
1515
fi
1616

17+
DOC_REMOTE="https://github.com/lampepfl/dotty-website.git"
18+
DOC_BRANCH="gh-pages"
19+
1720
echo "Working directory: $PWD"
1821

1922
# this command will generate docs in $PWD/docs/_site
@@ -30,8 +33,9 @@ fi
3033
GIT_HEAD=$(git rev-parse HEAD)
3134

3235
# 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"
3539

3640
# move newly generated _site dir to $PWD
3741
mv $PWD/docs/_site .
@@ -47,11 +51,12 @@ rm -rf _site
4751

4852
# set github credentials
4953
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"
5156

5257
# add all contents of $PWD to commit
5358
git add -A
5459
git commit -m "Update gh-pages site for $GIT_HEAD" || echo "nothing new to commit"
5560

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

Comments
 (0)