docs(circleci): Set up automatic deploys to GCP for hosting viewer.ohif.org (#491)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2019-06-05 22:08:28 +02:00
1 parent a111327ff6
commit d20492ac62
2 files changed
+63

No files matched your search

+62
View File
@@ -121,6 +121,56 @@ jobs:
docker push ohif/$IMAGE_NAME:$IMAGE_VERSION_FULL
docker push ohif/$IMAGE_NAME:latest
fi
build_demo_site:
<<: *defaults
steps:
# Download and cache dependencies
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
# when lock file changes, use increasingly general patterns to restore cache
- yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-packages-v1-{{ .Branch }}-
- yarn-packages-v1-
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
paths:
- ~/.cache/yarn
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
# Build & Test
- run: yarn build:demo:ci
# Persist :+1:
- persist_to_workspace:
root: ~/repo
paths: .
demo_site_publish:
working_directory: ~/repo
docker:
- image: google/cloud-sdk
steps:
- attach_workspace:
at: ~/repo
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Deploy latest version to viewer.ohif.org
command: |
# This file will exist if a new version was published by
# our `semantic-release` command in the previous job
#if [[ ! -e tmp/updated-version.txt ]]; then
# exit 0
#else
echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE}
gsutil -m rm gs://$GOOGLE_STORAGE_BUCKET/**
gsutil -m rsync -R build gs://$GOOGLE_STORAGE_BUCKET
#fi
workflows:
version: 2
@@ -153,3 +203,15 @@ workflows:
requires:
- build_and_test
- npm_publish
- build_demo_site:
requires:
- build_and_test
filters:
branches:
only: master
- demo_site_publish:
requires:
- build_demo_site
filters:
branches:
only: master