-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy
57 lines (47 loc) · 1.01 KB
/
deploy
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
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
readonly shortOptions='t:,v:'
readonly longOptions='target:,version:'
args=$(getopt -s bash -o "$shortOptions" -l "$longOptions" -- "$@")
[ $? -ne 0 ] && echo Erreur && exit 1
eval set -- "$args"
target="master"
while true
do
option="$1"
shift 1
case $option in
-t|--target)
target="$1"
shift 1
;;
-v|--version)
version="$1"
shift 1
;;
--) break ;;
esac
done
readonly branch=$1
[ -z "$branch" ] && echo "no branch defined" && exit 2
if [[ $target == "master" ]] || [[ $target == "develop" ]]
then
git checkout develop
git merge --no-ff --log "$branch"
fi
if [[ $target == "master" ]]
then
# merge in master
git checkout master
git merge --no-ff --log develop
# set the tag if any
if [ -n "$version" ]
then
echo "$version" > VERSION
git add VERSION
git commit -m "Set version to $version."
git tag -am "Version $version of project bash-completer" "$version"
fi
git rebase master develop
git push --tags origin develop master
fi