-
Notifications
You must be signed in to change notification settings - Fork 7
/
.travis.yml
55 lines (55 loc) · 2.19 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
group: deprecated-2017Q2 # see: https://blog.travis-ci.com/2017-06-21-trusty-updates-2017-Q2-launch
language: ruby
services:
- docker
env:
global:
- CI_BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
- CI_BUILD_ID=$TRAVIS_BUILD_ID
- CI_BUILD_REF=$TRAVIS_COMMIT
- CI_BUILD_REF_NAME=$TRAVIS_BRANCH
- CI_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER
- CI_BUILDER=travis-ci
- CI_PROJECT_NAME=$TRAVIS_REPO_SLUG
- GH_REPO=teracyhq/blog
- secure: ll0qKyaIMGw5Fw+CXNKUE5Afy9zNdQimJHLoyNKi8TzIBFgwyARq/IrTllxA+NTdSWoIGnfV1HHtEbpwbaYlwA+/HxbxGqTza995N8V1llEfp0m1E63dh3qfbKcvJ9Xhg6502VMeXyTYPKAK4nAl2FW4BVhwIrCOTfN1U4oseu8=
rvm:
- 1.9.3 # legacy
before_install:
# install the latest docker and docker-compose versions
- sudo apt-get remove docker docker-engine
- sudo curl -sSL https://get.docker.com/ | sh
- sudo rm /usr/local/bin/docker-compose
- export DOCKER_COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- docker version
- docker-compose version
# legacy stuff
- bundle install
- git config --global user.name "Teracy Bot"
- git config --global user.email "[email protected]"
- export REPO_URL="https://[email protected]/$GH_REPO.git"
- bundle exec rake setup_github_pages[$REPO_URL]
- git checkout -- _config.yml
before_script:
- export CI_REGISTRY_IMAGE=$DOCKER_USER/$DOCKER_REPO
- |
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
export IMG_TAG_AFFIX=`echo "${TRAVIS_BRANCH}" | sed -e 's/[\/]/-/g' | sed -e 's/[\#]//g'`
else
export IMG_TAG_AFFIX=latest
fi
- export DOCKER_IMAGE_DEV=$CI_REGISTRY_IMAGE:dev_$IMG_TAG_AFFIX
- export DOCKER_IMAGE_PROD=$CI_REGISTRY_IMAGE:$IMG_TAG_AFFIX
script:
- docker-compose build dev
- docker-compose run --rm dev rake generate
- docker-compose -f docker-compose.yml -f docker-compose.prod.yml build prod
after_script:
- bundle exec rake deploy
after_success:
- docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
- docker image push $DOCKER_IMAGE_DEV
- docker image push $DOCKER_IMAGE_PROD