-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
37 lines (28 loc) · 883 Bytes
/
deploy.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
#!/bin/bash
set -e # Exit with nonzero exit code if anything fails
SOURCE_BRANCH="master"
BUILD_DIR="build"
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
if [ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]
then
echo "Skipping deploy; just doing a build."
exit 0
fi
# Short hash of HEAD
rev=$(git rev-parse --short HEAD)
# Enter in the builded files directory
cd $BUILD_DIR
# Initialize a new repository then set name and email
git init
git config user.name "Travis CI"
git config user.email "$COMMIT_AUTHOR_EMAIL"
# Add and fetch our remote
git remote add upstream "https://[email protected]/wendelnascimento/Curso-git.git"
git fetch upstream
git reset upstream/gh-pages
echo "curso-git.wendelnascimento.com.br" > CNAME
ls -l
git add -A .
git status
git commit -m "rebuild pages at ${rev}"
git push -q upstream HEAD:gh-pages