Skip to content

Commit 07da825

Browse files
committed
Check branch to deploy
1 parent 3235244 commit 07da825

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ cache:
1515
env:
1616
global:
1717
- APP_ENV=prod
18+
- KUBERNETES_ENV=prod
1819

19-
# TODO: replace check by [ ! $TRAVIS_TAG ] && [ $TRAVIS_REPO_SLUG = "api-platform/demo" ] && [ $TRAVIS_PULL_REQUEST = "false" ] when ready because we only want to deploy on master and from verified sources.
2020
before_install:
2121
- |
22-
if [ $TRAVIS_PULL_REQUEST = "false" ]; then
22+
if [ TRAVIS_BRANCH = "master" ] && [ $TRAVIS_REPO_SLUG = "api-platform/demo" ]; then
2323
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash -s -- --version v2.9.1;
2424
else
25+
KUBERNETES_ENV=staging;
2526
exit 0;
2627
fi
2728
@@ -53,7 +54,7 @@ script:
5354
- curl -k https://localhost:8443
5455
- curl -k https://localhost:8444
5556

56-
# TODO: Keep looking to https://github.com/kubernetes/kubernetes/pull/64034 tests in order to use "wait" with new implementation (to replace sleep 60).
57+
# TODO: Keep looking to https://github.com/kubernetes/kubernetes/pull/64034 tests in order to use "wait" with new implementation (in order to replace sleep 60).
5758
after_success:
5859
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
5960
- chmod +x ./kubectl
@@ -76,7 +77,7 @@ after_success:
7677
- sleep 60
7778
- kubectl exec -it $(kubectl --namespace=${TRAVIS_COMMIT} get pods -l app=api-php -o jsonpath="{.items[0].metadata.name}") --namespace=${TRAVIS_COMMIT} -- ash -c 'export APP_ENV=dev && composer install -n && bin/console d:s:u --force --env=dev && bin/console hautelook:fixtures:load -n && APP_ENV=prod composer --no-dev install --classmap-authoritative && bin/console d:s:u --env=prod'
7879
- kubectl label namespace ${TRAVIS_COMMIT} app=api-demo
79-
- cd admin && REACT_APP_API_ENTRYPOINT=https://admin.api-platform.com yarn build --environment=prod
80+
- cd admin && REACT_APP_API_ENTRYPOINT=http://demo-admin.api-platform.com yarn build --environment=prod
8081
- gsutil mb -l europe-west1 -p api-platform-demo gs://demo-admin.api-platform.com
8182
- cd admin && gsutil cp -R build/* gs://demo-admin.api-platform.com/build
8283
- gsutil iam ch allUsers:objectViewer gs://demo-admin.api-platform.com

0 commit comments

Comments
 (0)