-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdeploy-gh-pages.sh
executable file
·49 lines (39 loc) · 1.05 KB
/
deploy-gh-pages.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
set -e
failure() {
local lineno=$1
echo "Failed at $lineno"
}
trap 'failure ${LINENO}' ERR
remote=https://$GIT_TOKEN@github.com/brainhubeu/react-file-input.git
yarn install --non-interactive
cd docs-www
yarn install --non-interactive
PATH_PREFIX=react-file-input yarn build
cd ..
mkdir -p gh-pages-branch
cd gh-pages-branch
git config --global user.email "devops@brainhub.eu" > /dev/null 2>&1
git config --global user.name "DevOps Brainhub" > /dev/null 2>&1
git init
git remote add origin $remote
git remote -v
git fetch origin
if git rev-parse --verify origin/gh-pages > /dev/null 2>&1
then
echo 'rev-parse true'
git checkout gh-pages
git rm -rf . || echo 'nothing to remove'
cp -r ../docs-www/public/* .
else
echo 'rev-parse false'
git checkout --orphan gh-pages
git rm -rf . || echo 'nothing to remove'
cp -r ../docs-www/public/* .
fi
git add -A
git commit --allow-empty -m "Deploy to GitHub pages [ci skip]"
git push --force --quiet origin gh-pages
cd ..
rm -rf gh-pages-branch
echo "Finished Deployment of gh pages!"