forked from Diabol/delivery-pipeline-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·40 lines (37 loc) · 1.33 KB
/
release.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
#!/bin/bash
set -x
set -e
if [ $# -eq 2 ]
then
branch=$1
tag=$2
else
echo "Incorrect number of arguments"
echo "Usage: release.sh <branch> <tag>"
fi
if [[ -n "$tag" ]] && [[ $tag =~ ^release-.* ]]; then
version=`echo $tag | sed -n 's/release-\(.\)/\1/p'`
head=`git rev-parse HEAD`
commit=`git rev-list -n 1 $tag`
if [[ "$head" == "$commit" ]]; then
# prepare the ssh key
openssl aes-256-cbc -K $encrypted_308f5ca9ca59_key -iv $encrypted_308f5ca9ca59_iv -in travis_deploy_key.enc -out travis_deploy_key -d
chmod 600 travis_deploy_key
eval `ssh-agent -s`
ssh-add travis_deploy_key
# prepare the repo
git config user.name "diabolbuilder"
git config user.email "[email protected]"
git config --global push.default simple
remote=`git config remote.origin.url | sed -n 's/https:\/\/github.com\/\(.*\)/[email protected]:\1/p'`
git remote remove origin
git remote add origin $remote
git fetch
git checkout -qf $branch
# do the release
mvn --settings settings.xml --batch-mode -DreleaseVersion=$version -Dwebdriver.chrome.driver=/usr/local/share/chromedriver -Darguments="-DskipTests=true" -DskipTests=true -DscmCommentPrefix="[maven-release-plugin][skip ci]" release:prepare release:perform
else
echo "Tag $tag does not point to $branch/head, aborting release"
exit 1
fi
fi