forked from RWS/languagecloud-api-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
releaseDocs.sh
33 lines (24 loc) · 832 Bytes
/
releaseDocs.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
#! /bin/sh
set -e
echo "Build the documentation site"
SOURCE_DIR=$PWD
TEMP_REPO_DIR=$PWD/../docs-gh-pages
ACTOR=$1
TOKEN=$2
remote_repo="https://${ACTOR}:${TOKEN}@github.com/rws/languagecloud-api-docs.git"
echo "Removing temporary doc directory $TEMP_REPO_DIR"
rm -rf $TEMP_REPO_DIR
mkdir $TEMP_REPO_DIR
echo "Cloning the repo ${remote_repo} with the gh-pages branch"
git clone ${remote_repo} --branch gh-pages $TEMP_REPO_DIR
echo "Clear repo directory"
cd $TEMP_REPO_DIR
git rm -r *
echo "Copy documentation into the repo"
cp -r $SOURCE_DIR/_site/* .
echo "Push the new docs to the remote branch"
git config --local user.email "github-actions[bot]@users.noreply.sdl.com"
git config --local user.name "github-actions[bot]"
git add . -A
git commit -m "Update generated documentation"
git push "${remote_repo}" HEAD:gh-pages