Created
May 2, 2019 04:12
-
-
Save miukki/713a26a854d9229720e6b6d50d3f5b27 to your computer and use it in GitHub Desktop.
Deploy to s3 bucket front-end stack using circle CI using workflows with AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Javascript Node CircleCI 2.0 configuration file | |
# | |
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | |
# | |
version: 2 | |
jobs: | |
build: | |
docker: | |
# specify the version you desire here | |
- image: circleci/node:8.11-stretch-browsers | |
# Specify service dependencies here if necessary | |
# CircleCI maintains a library of pre-built images | |
# documented at https://circleci.com/docs/2.0/circleci-images/ | |
# - image: circleci/mongo:3.4.4 | |
working_directory: ~/repo | |
steps: | |
- checkout | |
# Download and cache dependencies | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ checksum "package.json" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
# - run: npm rebuild node-sass --force | |
- run: yarn install | |
- save_cache: | |
paths: | |
- node_modules | |
key: v1-dependencies-{{ checksum "package.json" }} | |
# run tests! | |
- run: yarn test | |
# run build! | |
- run: yarn build | |
# - store_artifacts: | |
# path: public/ | |
# destination: repo | |
- persist_to_workspace: | |
root: ~/repo | |
paths: | |
- public | |
# deploy to aws s3 cirkle.shop | |
deploycirkleshop: | |
docker: | |
- image: cibuilds/aws:1.15.73 | |
environment: | |
aws_access_key_id: $AWS_ACCESS_KEY_ID | |
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY | |
steps: | |
- attach_workspace: | |
at: ./workspace | |
- run: | |
name: Deploy to S3 if tests pass and branch is develop | |
command: aws s3 sync workspace/public s3://cirkle.shop/ --delete | |
# deploy to aws s3 cirkleproject.com | |
deploycirkleprojectcom: | |
docker: | |
- image: cibuilds/aws:1.15.73 | |
environment: | |
aws_access_key_id: $AWS_ACCESS_KEY_ID | |
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY | |
steps: | |
- attach_workspace: | |
at: ./workspace | |
- run: | |
name: Deploy to S3 if tests pass and branch is develop | |
command: aws s3 sync workspace/public s3://cirkleproject.com/ --delete | |
# deploy to aws s3 cirkleproject.com.au | |
deploycirkleprojectcomau: | |
docker: | |
- image: cibuilds/aws:1.15.73 | |
environment: | |
aws_access_key_id: $AWS_ACCESS_KEY_ID | |
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY | |
steps: | |
- attach_workspace: | |
at: ./workspace | |
- run: | |
name: Deploy to S3 if tests pass and branch is develop | |
command: aws s3 sync workspace/public s3://cirkleproject.com.au/ --delete | |
workflows: | |
version: 2 | |
build-deploy: | |
jobs: | |
- build | |
- deploycirkleshop: | |
requires: | |
- build | |
filters: | |
branches: | |
only: develop | |
- deploycirkleprojectcom: | |
requires: | |
- build | |
filters: | |
branches: | |
only: develop | |
- deploycirkleprojectcomau: | |
requires: | |
- build | |
filters: | |
branches: | |
only: develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Javascript Node CircleCI 2.0 configuration file | |
# | |
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | |
# | |
version: 2 | |
jobs: | |
build: | |
docker: | |
# specify the version you desire here | |
- image: circleci/node:8.11-stretch-browsers | |
# Specify service dependencies here if necessary | |
# CircleCI maintains a library of pre-built images | |
# documented at https://circleci.com/docs/2.0/circleci-images/ | |
# - image: circleci/mongo:3.4.4 | |
working_directory: ~/repo | |
steps: | |
- checkout | |
# Download and cache dependencies | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ checksum "package.json" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
# - run: npm rebuild node-sass --force | |
- run: yarn install | |
- save_cache: | |
paths: | |
- node_modules | |
key: v1-dependencies-{{ checksum "package.json" }} | |
# run tests! | |
- run: yarn test | |
# run build! | |
- run: yarn build | |
# - store_artifacts: | |
# path: public/ | |
# destination: repo | |
- persist_to_workspace: | |
root: ~/repo | |
paths: | |
- public | |
# deploy to aws s3 cirkle.shop | |
deploycirkleshop: | |
docker: | |
- image: cibuilds/aws:1.15.73 | |
environment: | |
aws_access_key_id: $AWS_ACCESS_KEY_ID | |
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY | |
steps: | |
- attach_workspace: | |
at: ./workspace | |
- run: | |
name: Deploy to S3 if tests pass and branch is develop | |
command: aws s3 sync workspace/public s3://cirkle.shop/ --delete | |
# deploy to aws s3 cirkleproject.com | |
deploycirkleprojectcom: | |
docker: | |
- image: cibuilds/aws:1.15.73 | |
environment: | |
aws_access_key_id: $AWS_ACCESS_KEY_ID | |
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY | |
steps: | |
- attach_workspace: | |
at: ./workspace | |
- run: | |
name: Deploy to S3 if tests pass and branch is develop | |
command: aws s3 sync workspace/public s3://cirkleproject.com/ --delete | |
# deploy to aws s3 cirkleproject.com.au | |
deploycirkleprojectcomau: | |
docker: | |
- image: cibuilds/aws:1.15.73 | |
environment: | |
aws_access_key_id: $AWS_ACCESS_KEY_ID | |
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY | |
steps: | |
- attach_workspace: | |
at: ./workspace | |
- run: | |
name: Deploy to S3 if tests pass and branch is develop | |
command: aws s3 sync workspace/public s3://cirkleproject.com.au/ --delete | |
workflows: | |
version: 2 | |
build-deploy: | |
jobs: | |
- build | |
- deploycirkleshop: | |
requires: | |
- build | |
filters: | |
branches: | |
only: develop | |
- deploycirkleprojectcom: | |
requires: | |
- build | |
filters: | |
branches: | |
only: develop | |
- deploycirkleprojectcomau: | |
requires: | |
- build | |
filters: | |
branches: | |
only: develop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment