|
| 1 | +# Javascript Node CircleCI 2.0 configuration file |
| 2 | +# |
| 3 | +# Check https://circleci.com/docs/2.0/language-javascript/ for more details |
| 4 | +# |
| 5 | +version: 2 |
| 6 | +jobs: |
| 7 | + deployToStaging: |
| 8 | + docker: |
| 9 | + - image: circleci/node:10.15.0 |
| 10 | + |
| 11 | + working_directory: ~/repo |
| 12 | + |
| 13 | + steps: |
| 14 | + - checkout |
| 15 | + |
| 16 | + - run: yarn config set prefix ~/.yarn |
| 17 | + |
| 18 | + # Download and cache dependencies |
| 19 | + - restore_cache: |
| 20 | + keys: |
| 21 | + # when lock file changes, use increasingly general patterns to restore cache |
| 22 | + - node-v1-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }} |
| 23 | + # - node-v1-{{ .Branch }}- |
| 24 | + # - node-v1- |
| 25 | + |
| 26 | + # this has to be a global else amplify craps out don't ask. |
| 27 | + # i guess there's probably a way to have yarn not install it if not needed |
| 28 | + # but this is quite a bit faster than using `yarn list --patern amplify` |
| 29 | + - run: "if [ -e $HOME/.yarn/bin/amplify ]; then echo 'amplify already installed globally, skipping'; else yarn global add @aws-amplify/cli@multienv; fi" |
| 30 | + - run: yarn |
| 31 | + |
| 32 | + - save_cache: |
| 33 | + paths: |
| 34 | + - node_modules |
| 35 | + # capture globally installed amplify CLI...it doesn't work |
| 36 | + # when executing it locally via node_modules/.bin/amplify so w/e |
| 37 | + - ~/.yarn |
| 38 | + # previous one symlinks into here |
| 39 | + - ~/.config/yarn |
| 40 | + key: node-v1-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }} |
| 41 | + |
| 42 | + # amplify doesn't presently support creds as environment variables so |
| 43 | + # we write ~/.aws/credentials based on environment variables. ok sure |
| 44 | + - run: ./script/write_aws_creds_file.sh |
| 45 | + - run: ./script/amplify_init.sh |
| 46 | + - run: ~/.yarn/bin/amplify env checkout staging |
| 47 | + - run: ~/.yarn/bin/amplify publish -y |
| 48 | + |
| 49 | +workflows: |
| 50 | + version: 2 |
| 51 | + deployToStagingAndTest: |
| 52 | + jobs: |
| 53 | + - deployToStaging |
| 54 | + # at first we will deploy everything but really this should be just for |
| 55 | + # PRs against master; uncomment this. |
| 56 | + # branches: |
| 57 | + # ignore: |
| 58 | + # - master |
0 commit comments