forked from niondir/iot-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-github.sh
42 lines (29 loc) · 961 Bytes
/
deploy-github.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
#!/bin/bash
set -o errexit -o nounset
CNAME="demo.iot-dashboard.org"
#BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
BRANCH_NAME=${TRAVIS_BRANCH}
REV=$(git rev-parse --short HEAD)
rm -rf _deployment
mkdir _deployment
cd _deployment
echo "Initializing and configuring git.."
git init
git config user.name "Travis CI"
git config user.email "[email protected]"
echo "Setting upstream and branch..."
git remote add upstream "https://[email protected]/niondir/iot-dashboard"
git fetch upstream
git checkout upstream/gh-pages
echo ${CNAME} > CNAME
touch .
echo "Updating ${BRANCH_NAME} folder"
TARGET_DIR="./branch/${BRANCH_NAME}/"
git rm -rf --ignore-unmatch ${TARGET_DIR}
mkdir -p ${TARGET_DIR}
cp -r ../dist/* ${TARGET_DIR}
echo "Git add, commit and pushing..."
git add -A .
git commit -m "Deploying branch ${BRANCH_NAME} @ ${REV} to GitHub pages"
git push -q upstream HEAD:gh-pages
echo "Deployed on http://${CNAME}/branch/${BRANCH_NAME}/"