Skip to content

Instantly share code, notes, and snippets.

@nem035
Last active November 26, 2018 20:13
Show Gist options
  • Select an option

  • Save nem035/fe5dc0677ab595b299869fff32e0903e to your computer and use it in GitHub Desktop.

Select an option

Save nem035/fe5dc0677ab595b299869fff32e0903e to your computer and use it in GitHub Desktop.
version: 2
jobs:
# job that installs our dependencies
# and persists them to the workspace
# so other jobs can use them
install:
working_directory: ~/enki-project
docker:
- image: enkici/circle-node-awscli:8.10.0
steps:
- checkout
- attach_workspace:
at: ~/enki-project
- run:
name: NPM Install
command: npm install
- persist_to_workspace:
root: ~/enki-project
paths: ./node_modules
# job that builds our code
# and generates a distribution folder called `dist`
build:
working_directory: ~/enki-project
docker:
- image: enkici/circle-node-awscli:8.10.0
steps:
- checkout
- attach_workspace:
at: ~/enki-project
- run:
name: Build
command: npm run build
- persist_to_workspace:
root: ~/enki-project
paths: ./dist
# job that lints our code using ESLint installed
# in the install step.
lint:
working_directory: ~/enki-project
docker:
- image: enkici/circle-node-awscli:8.10.0
steps:
- checkout
- attach_workspace:
at: ~/enki-project
- run:
name: Lint
command: npm run lint
# job that deploys the built distribution to S3
deploy:
working_directory: ~/enki-project
docker:
- image: enkidevs/circle-node-awscli:8.10.0
environment:
S3_BUCKET_NAME: example.com
steps:
- checkout
- attach_workspace:
at: ~/enki-project
- run:
name: Deploy
command: |
aws s3 sync \
--acl public-read \
--sse \
--delete \
./dist s3://"${S3_BUCKET_NAME}"
workflows:
version: 2
install_build_lint_deploy:
jobs:
- install
- build:
requires:
- install
- lint:
requires:
- install
- deploy:
requires:
- build
- lint
filters:
branches:
only:
- develop
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment