-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
42 lines (33 loc) · 1.11 KB
/
deploy.sh
File metadata and controls
42 lines (33 loc) · 1.11 KB
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
#!/bin/bash
cd ..
echo "On Branch: $TRAVIS_BRANCH"
#deploy gh-pages
echo '[deploy_gh-pages]: create new temp dir'
mkdir deployGH-PAGES
cd deployGH-PAGES
echo '[deploy_gh-pages]: clone gh-pages branch'
git clone -b gh-pages https://github.com/${TRAVIS_REPO_SLUG}.git
export TRAVIS_REPO_NAME=${TRAVIS_REPO_SLUG#*/}
cd ${TRAVIS_REPO_NAME}
echo '[deploy_gh-pages]: configuring git'
git config --global push.default simple
git config user.name "Travis CI"
git config user.email "deploy@travis-ci.org"
echo '[deploy_gh-pages]: copy new files'
if [ "$TRAVIS_BRANCH" == "master" ]; then
rm -f *
cp -r ../../fantastic-feasts/dist/* .
else
rm -rf "$TRAVIS_BRANCH"
mkdir -p "$TRAVIS_BRANCH"
cd "$TRAVIS_BRANCH"
cp -r ../../../fantastic-feasts/dist/* .
fi
echo '[deploy_gh-pages]: git add & commit'
git add --all
git commit -m "Deploy code docs to GitHub Pages Travis build: ${TRAVIS_BUILD_NUMBER}" -m "Commit: ${TRAVIS_COMMIT}"
echo '[deploy_gh-pages]: git push'
git push --force "https://${GH_REPO_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git"
echo '[deploy_gh-pages]: remove temp dir'
cd ../..
rm -rf deployGH-PAGES