-
Notifications
You must be signed in to change notification settings - Fork 12
/
travis-promote.sh
59 lines (59 loc) · 2.54 KB
/
travis-promote.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
52
53
54
55
56
57
58
59
echo "Build $TRAVIS_JOB_NUMBER"
echo "Git: $TRAVIS_COMMIT [$TRAVIS_BRANCH]"
echo "Java version: $TRAVIS_JDK_VERSION"
CURRENT_TAG=$(git name-rev --name-only --tags HEAD)
if [ $CURRENT_TAG == 'undefined' ]
then
if [ $TRAVIS_PULL_REQUEST == 'false' ]
then
echo "Promoting an untagged build on dartdesigner.github.io/p2/nightly"
cd repositories/org.obeonetwork.dsl.dart.repository/target
git clone https://[email protected]/dartdesigner/p2.git -b gh-pages --quiet
if [ -d p2/nightly ]
then
rm -r p2/nightly
echo "An old version of the nightly repository has been found and removed"
fi
echo "Creating the nighly repository"
cp -r repository p2/
mv p2/repository p2/nightly
echo "Nightly repository created"
ls p2/nightly
cd p2
git config user.email "[email protected]"
git config user.name "Stéphane Bégaudeau"
git remote rm origin
git remote add origin https://dartdesigner:[email protected]/dartdesigner/p2.git
git add -A
git commit -m "Promoting a new nightly build for https://github.com/dartdesigner/Dart-Designer/commit/$TRAVIS_COMMIT [$TRAVIS_BRANCH]"
git push origin gh-pages --quiet &>/dev/null
echo "Build promoted."
fi
else
if [ $TRAVIS_PULL_REQUEST == 'false' ]
then
LAST_TAG=$(git describe --abbrev=0 --tags)
echo "Promoting the release $LAST_TAG on dartdesigner.github.io/p2/releases/$LAST_TAG"
cd repositories/org.obeonetwork.dsl.dart.repository/target
git clone https://[email protected]/dartdesigner/p2.git -b gh-pages --quiet
if [ -d p2/releases/$LAST_TAG ]
then
rm -r p2/releases/$LAST_TAG
echo "An old version of the nightly repository has been found and removed"
fi
echo "Creating the nighly repository"
cp -r repository p2/
mkdir -p p2/releases
mv p2/repository p2/releases/$LAST_TAG
echo "Releases repository created"
cd p2
git config user.email "[email protected]"
git config user.name "Stéphane Bégaudeau"
git remote rm origin
git remote add origin https://dartdesigner:[email protected]/dartdesigner/p2.git
git add -A
git commit -m "Promoting a new nightly build for https://github.com/dartdesigner/Dart-Designer/commit/$TRAVIS_COMMIT [$TRAVIS_BRANCH]"
git push origin gh-pages --quiet &>/dev/null
echo "Build promoted."
fi
fi