-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
70 lines (66 loc) · 2.23 KB
/
.travis.yml
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
60
61
62
63
64
65
66
67
68
69
70
sudo: required
services:
- docker
env:
global:
- REPO=netresearch/akeneo-app
script:
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
# Tag types:
# 0: Branch without version relation
# 1: Version branch (1.6/1.7)
# 2: Version tag (1.7.6/1.6.18)
- export TAG_TYPE=$(grep -o "\." <<< "$TRAVIS_BRANCH" | wc -l)
- >
eval $(cat .env);
BOOTSTRAP_VERSION="dev-$TRAVIS_BRANCH";
if [ "$TAG_TYPE" == "1" ]; then
BOOTSTRAP_VERSION="$TRAVIS_BRANCH.x-dev";
fi;
if [ "$TAG_TYPE" == "2" ]; then
BOOTSTRAP_VERSION="$TAG";
fi;
COUNTER=0;
while : ; do
PACKAGIST_OUTPUT=$(composer show --no-ansi -al netresearch/akeneo-bootstrap $BOOTSTRAP_VERSION 2>&1)
PACKAGIST_UPDATED=$(echo $PACKAGIST_OUTPUT | grep $TRAVIS_COMMIT);
if [ "$PACKAGIST_UPDATED" ];
then
break;
else
echo -n "Latest commit on packagist version doesn't match current - ";
if [ $COUNTER -lt 20 ];
then
let COUNTER+=1;
rm -rf $HOME/.composer/cache;
echo "retrying";
sleep 3;
else
echo "FAILED (see below)";
echo "Command: composer show -al netresearch/akeneo-bootstrap $BOOTSTRAP_VERSION";
echo "Expected commit: $TRAVIS_COMMIT";
echo "Output: $(echo $PACKAGIST_OUTPUT | sed 's/\r//g')";
exit 1;
fi;
fi;
done;
echo "Building with:";
echo " AKENEO_VERSION: $AKENEO_VERSION";
echo " AKENEO_DIRECTORY: $AKENEO_DIRECTORY";
echo " PACKAGES_DIRECTORY: $PACKAGES_DIRECTORY";
echo " BOOTSTRAP_VERSION: $BOOTSTRAP_VERSION";
docker build \
--build-arg "AKENEO_VERSION=$AKENEO_VERSION" \
--build-arg "AKENEO_DIRECTORY=$AKENEO_DIRECTORY" \
--build-arg "PACKAGES_DIRECTORY=$PACKAGES_DIRECTORY" \
--build-arg "BOOTSTRAP_VERSION=$BOOTSTRAP_VERSION" \
-t "$REPO:$TAG" .
after_success:
- >
docker login -u $DOCKER_USER -p $DOCKER_PASS;
if [ "$TAG" == "latest" ]; then
ALIAS=$(echo "$AKENEO_VERSION" | cut -c -3);
docker tag "$REPO:$TAG" "$REPO:$ALIAS";
docker push "$REPO:$ALIAS";
fi;
docker push "$REPO:$TAG";