Created
May 25, 2018 02:07
-
-
Save matsubo/82fa2c751b38e7cb9a47ad3f367c181a to your computer and use it in GitHub Desktop.
.circleci/config.yml
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-job: | |
docker: | |
- image: circleci/node:latest | |
working_directory: ~/repo | |
steps: | |
- checkout | |
- run: yarn install | |
- run: sudo yarn global add gulp | |
- run: gulp compile-scss | |
deploy-job: | |
docker: | |
- image: circleci/node:7.10 | |
working_directory: ~/repo | |
steps: | |
- checkout | |
- run: | |
name: Install newer version of awscli | |
command: | | |
sudo apt-get install python-dev python-pip | |
pip install awscli --user | |
- run: | |
name: Deploy to S3 if tests pass and branch is Master | |
command: /home/circleci/.local/bin/aws s3 sync . s3://<bucket name>/ --delete --exclude=".git/*" --exclude=".circleci/*" --exclude="node_modules/*" --exclude="README.md" --region=ap-northeast-1 | |
- run: | |
name: Invalidate CloudFront | |
command: | | |
/home/circleci/.local/bin/aws cloudfront create-invalidation --distribution-id <distribution id> --paths '/*' | |
workflows: | |
version: 2 | |
build-deploy: | |
jobs: | |
- build-job | |
- deploy-job: | |
requires: | |
- build-job | |
filters: | |
branches: | |
only: master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment