|
| 1 | +sudo: required |
| 2 | +services: |
| 3 | +- docker |
| 4 | +env: |
| 5 | + global: |
| 6 | + # Ensure the install happens without prompts |
| 7 | + - CLOUDSDK_CORE_DISABLE_PROMPTS=1 |
1 | 8 | language: node_js |
2 | 9 | node_js: |
3 | | - - "6" |
| 10 | +- '6' |
| 11 | +before_install: |
| 12 | +- echo "Cloudboost Docs" |
| 13 | +- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl |
| 14 | +- chmod +x ./kubectl |
| 15 | +- sudo mv ./kubectl /usr/local/bin/kubectl |
4 | 16 | install: |
5 | | - - npm install |
| 17 | +- sudo apt-get update |
| 18 | +- sudo apt-get install curl libc6 libcurl3 zlib1g |
| 19 | +- npm install |
| 20 | +after_success: |
| 21 | +# Build Docker Images |
| 22 | +- docker build -t cloudboost/docs:2.0.$TRAVIS_BUILD_NUMBER . |
| 23 | +- if [ "$TRAVIS_BRANCH" == "master" ]; then |
| 24 | + docker build -t cloudboost/docs:latest .; |
| 25 | + fi |
| 26 | +# Docker Deploy for staging builds |
| 27 | +- if [ "$TRAVIS_BRANCH" == "staging" ]; then |
| 28 | + docker build -t cloudboost/docs:staging .; |
| 29 | + docker login --username $DOCKERUSERNAME --password $DOCKERPASSWORD --email $DOCKEREMAIL; |
| 30 | + docker push cloudboost/docs:staging; |
| 31 | + git clone https://github.com/CloudBoost/kube-cred.git; |
| 32 | + cd kube-cred; |
| 33 | + openssl enc -in config.enc -out config -d -aes256 -k $KUBE_ENC; |
| 34 | + mkdir ~/.kube; |
| 35 | + mv config ~/.kube/; |
| 36 | + kubectl rolling-update cloudboost-docs-staging --image=cloudboost/docs:staging --image-pull-policy=Always; |
| 37 | + curl -X DELETE "https://api.cloudflare.com/client/v4/zones/""$cloudflare_zone""/purge_cache" -H "X-Auth-Email:[email protected]" -H "X-Auth-Key:""$cloud_flare_key" -H "Content-Type:application/json" --data "{'purge_everything':true}"; |
| 38 | + fi |
| 39 | +before_deploy: |
| 40 | + - git config --global user.email "[email protected]" |
| 41 | + - git config --global user.name "Travis CI" |
| 42 | + - export GIT_TAG=2.0.$TRAVIS_BUILD_NUMBER |
| 43 | + - git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER" |
| 44 | + - git push -q https://[email protected]/CloudBoost/docs --tags |
| 45 | + - ls -R |
6 | 46 | deploy: |
7 | | - provider: azure_web_apps |
8 | | - username: "$azure_deployment_user" |
9 | | - password: "$azure_deployment_password" |
10 | | - site: "$azure_deployment_sitename" |
| 47 | + provider: releases |
| 48 | + api_key: $GH_TOKEN |
| 49 | + file: "README.md" |
| 50 | + skip_cleanup: true |
| 51 | + on: |
| 52 | + tags: false |
| 53 | + branch: master |
| 54 | +after_deploy: |
| 55 | +# Docker Deploy. |
| 56 | +- if [ "$TRAVIS_BRANCH" == "master" ]; then |
| 57 | + docker login --username $DOCKERUSERNAME --password $DOCKERPASSWORD --email $DOCKEREMAIL; |
| 58 | + docker push cloudboost/docs:2.0.$TRAVIS_BUILD_NUMBER; |
| 59 | + docker push cloudboost/docs:latest; |
| 60 | + git clone https://github.com/CloudBoost/kube-cred.git; |
| 61 | + cd kube-cred; |
| 62 | + openssl enc -in config.enc -out config -d -aes256 -k $KUBE_ENC; |
| 63 | + mkdir ~/.kube; |
| 64 | + mv config ~/.kube/; |
| 65 | + kubectl rolling-update cloudboost-docs --image=cloudboost/docs:latest --image-pull-policy=Always; |
| 66 | + curl -X DELETE "https://api.cloudflare.com/client/v4/zones/""$cloudflare_zone""/purge_cache" -H "X-Auth-Email:[email protected]" -H "X-Auth-Key:""$cloud_flare_key" -H "Content-Type:application/json" --data "{'purge_everything':true}"; |
| 67 | + fi |
| 68 | +branches: |
| 69 | + except: |
| 70 | + - /^*-v[0-9]/ |
| 71 | +#Notify Team on Slack |
| 72 | +notifications: |
| 73 | + slack: cloudboost:gm7nWJDLDtBRyF75VKLKOoMW |
| 74 | + |
0 commit comments