forked from openfisca/openfisca-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·27 lines (24 loc) · 947 Bytes
/
publish.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
#!/bin/sh
set -ex
git clone --branch gh-pages https://github.com/openfisca/openfisca.org.git
mv build/html doc
rm --recursive --force openfisca.org/doc
mv doc openfisca.org/doc
cd openfisca.org
git fetch # Make sure we are up to date with git remote branches
git add --all
git config --global user.name "OpenFisca-Bot"
git config --global user.email "bot@openfisca.org"
git diff-index --quiet HEAD || git commit --message="[skip ci] Update doc"
git push https://github.com/openfisca/openfisca.org.git gh-pages
if git status --untracked-files=no ; then
echo "There was an issue pushing to openfisca.org"
fi
rm --recursive --force $(git ls-files | grep --invert-match doc) # remove all files in the branch except the doc file.
# keep the context while changing branch
git checkout --detach
git reset --soft origin/doc-html
git checkout doc-html
git add --all
git diff-index --quiet HEAD || git commit --message="[skip ci] Update doc"
git push