-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·46 lines (43 loc) · 1.03 KB
/
deploy.sh
File metadata and controls
executable file
·46 lines (43 loc) · 1.03 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
43
44
45
#!/bin/bash
if test -z "$TRAVIS_BRANCH"
then
TRAVIS_BRANCH=master
echo I\'m not on travis-ci
fi
set -e
if test "$TRAVIS_BRANCH" == "master"
then
if test -z "$GH_TOKEN"
then
echo I don\'t have the GH token!
exit -1
fi
echo Deploying to GitHub Pages ...
name=$(git --no-pager show -s --format="%aN")
email=$(git --no-pager show -s --format="%ae")
git --no-pager show -s --format="%s" >.msg
echo Today\'s commit belongs to "$name" \("$email"\)
echo Commit message:
if ! test -f .msg
then
echo No commit message file
exit -1
fi
cat .msg
echo Cloning pages
git clone --depth 1 --branch pages-base https://$GH_TOKEN@github.com/ccfd/course_materials.git deploy
mkdir -p deploy/pdf/
cp pdf/*.pdf deploy/pdf/
pushd deploy
git config user.email "$email"
git config user.name "$name"
git branch -f gh-pages pages-base
git checkout gh-pages
git add pdf/*.pdf
git commit -F ../.msg
git push --force --set-upstream origin gh-pages
popd
rm -fr deploy
else
echo Not in master branch. I won\'t upload to GitHub Pages
fi