-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.sh
executable file
·43 lines (35 loc) · 1.25 KB
/
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
38
39
40
41
42
43
#!/bin/bash
echo "Running deployment script..."
CURRENT_COMMIT=`git rev-parse HEAD`
branch=$TRAVIS_BRANCH
version=${branch##*/}
# Change the branch used if applicable (e.g. gh-pages)
echo "Cloning master branch..."
# Hide output since we use an access token here
git clone "https://${GH_TOKEN}@github.com/daolf/grunt-gallery.git" ../goodDepot > /dev/null 2>&1 || exit 1
cd ../goodDepot
echo "Committing and pushing to GH"
git config user.name "daolf"
git config user.email "[email protected]"
echo "git checkout $branch"
git checkout $branch
echo "git checkout develop"
git checkout develop
echo "git merge --no-ff $branch"
git merge --no-ff --no-edit $branch
echo "git checkout master"
git checkout master
echo "git merge --no-ff $branch"
git merge --no-ff --no-edit $branch
echo "git tag $version"
git tag $version
# Commit changes, allowing empty changes (when unchanged)
git add -A .
git commit --allow-empty -m "Travis build $TRAVIS_BUILD_NUMBER for release $version" || exit 1
# Push to branch
git push --tags origin master > /dev/null > /dev/null 2>&1 || exit 1
git push origin develop > /dev/null > /dev/null 2>&1 || exit 1
echo "remove release branch"
git push origin :$branch > /dev/null 2>&1 || exit 1
echo "Pushed deployment successfully"
exit 0