-
Notifications
You must be signed in to change notification settings - Fork 7
/
.travis.yml
28 lines (28 loc) · 1.02 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
services: docker
env:
global:
- GCP_PROJECT_ID=your-project-id
- IMAGE=gcr.io/your-project-id/example-app
- CLOUD_RUN_SERVICE=example-app
- CLOUD_RUN_REGION=us-central1
- CLOUDSDK_CORE_DISABLE_PROMPTS=1 # prevent gcloud from prompting
before_install:
- echo REMOVE_ME # replace with the openssl command from "travis encrypt-file"
- curl https://sdk.cloud.google.com | bash > /dev/null
- source "$HOME/google-cloud-sdk/path.bash.inc"
- gcloud auth activate-service-account --key-file=google-key.json
- gcloud auth configure-docker # enable "docker push" to gcr
- gcloud config set project "${GCP_PROJECT_ID}"
- gcloud components install beta # until Cloud Run is generally available (GA)
install: true # no-op
script:
- |
set -ex;
docker build -t "${IMAGE}:${TRAVIS_COMMIT}" ./src && \
docker push "${IMAGE}:${TRAVIS_COMMIT}" && \
gcloud beta run deploy "${CLOUD_RUN_SERVICE}" \
--image="${IMAGE}:${TRAVIS_COMMIT}" \
--platform=managed \
--region="${CLOUD_RUN_REGION}" \
--allow-unauthenticated;
set +x