forked from brailleapps/dotify-studio-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·51 lines (39 loc) · 1.39 KB
/
publish.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
44
45
46
47
48
49
50
51
#!/bin/bash
#version: 2017-11-18
repo=dotify-studio-installer
version=`grep 'version=' gradle.properties | grep -E -o '[0-9\.]+.+$'`
if [[ $version == *SNAPSHOT ]]; then
is_release=false
else
is_release=true
fi
if [ `git diff --name-only HEAD HEAD~ | grep gradle.properties -c` = 1 ]; then
prop_change="true"
else
prop_change="false"
fi
echo "Version: $version"
echo "Is release: $is_release"
echo "Properties changed: $prop_change"
if [ "$prop_change" = "false" ]; then
if [ "$is_release" = "true" ]; then
echo "No version change since last commit. Is this really a release?"
exit 1
fi
fi
if [ "$TRAVIS_REPO_SLUG" == "brailleapps/$repo" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$is_release" = true ]; then
echo -e "Publishing...\n"
mkdir -p $HOME/$repo/$version
cp -R build/distributions/* $HOME/$repo/$version
cd $HOME
git config --global user.email "[email protected]"
git config --global user.name "travis-ci"
git clone --quiet https://${GH_TOKEN}@github.com/brailleapps/brailleapps.github.io > /dev/null
cd brailleapps.github.io
git rm -rf ./$repo/$version
cp -Rf $HOME/$repo/. ./$repo
git add -f .
git commit -m "Lastest successful travis build of $repo ($TRAVIS_BUILD_NUMBER) auto-pushed to brailleapps.github.io"
git push -fq origin master > /dev/null
echo -e "Published artifacts to brailleapps.github.io.\n"
fi