zakscode/.circleci/config.yml

101 lines
1.9 KiB
YAML
Raw Normal View History

2019-04-11 16:58:32 -04:00
version: 2
jobs:
build:
docker:
- image: circleci/node:10.4-browsers
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run:
name: Install Dependancies
command: yarn
- save_cache:
key: v1-dependencies-{{ checksum "package.json" }}
2019-04-11 17:00:20 -04:00
paths:
- node_modules
2019-04-11 16:58:32 -04:00
- run:
name: Build
2019-04-11 17:39:10 -04:00
command: yarn build -c ${CIRCLE_BRANCH}
2019-04-11 16:58:32 -04:00
- persist_to_workspace:
root: ./
2019-04-11 17:00:20 -04:00
paths:
- dist/ZaksCode
2019-04-11 16:58:32 -04:00
- store_artifacts:
path: ./dist/ZaksCode
deploy:
docker:
- image: google/cloud-sdk:latest
working_directory: ~/repo
steps:
- checkout
- attach_workspace:
at: ./
2019-04-11 17:07:47 -04:00
- run:
name: Authenticate GCP
command: |
echo $GCLOUD_SERVICE_KEY > key.json
gcloud auth activate-service-account --key-file key.json
2019-04-11 16:58:32 -04:00
- run:
name: Deploy
2019-04-11 17:39:10 -04:00
command: gsutil cp -r dist/ZaksCode/* gs://staging.zakscode.com
2019-04-11 16:58:32 -04:00
deploy-prod:
docker:
- image: google/cloud-sdk:latest
working_directory: ~/repo
steps:
- checkout
- attach_workspace:
at: ./
2019-04-11 17:07:47 -04:00
- run:
name: Authenticate GCP
command: |
echo $GCLOUD_SERVICE_KEY > key.json
gcloud auth activate-service-account --key-file key.json
2019-04-11 16:58:32 -04:00
- run:
name: Depoly
command: gsutil cp -r dist/ZaksCode/* gs://zaks-code.appspot.com
workflows:
version: 2
build_and_deply:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
- deploy-prod:
requires:
- build
filters:
branches:
only: production