forked from stuartsan/lighthouse-circleci-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adjust a bunch of crap to get successful deploys on push w reasonable
caching
- Loading branch information
Showing
9 changed files
with
7,180 additions
and
236 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Javascript Node CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | ||
# | ||
version: 2 | ||
jobs: | ||
deployToStaging: | ||
docker: | ||
- image: circleci/node:10.15.0 | ||
|
||
working_directory: ~/repo | ||
|
||
steps: | ||
- checkout | ||
|
||
- run: yarn config set prefix ~/.yarn | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
# when lock file changes, use increasingly general patterns to restore cache | ||
- node-v1-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }} | ||
# - node-v1-{{ .Branch }}- | ||
# - node-v1- | ||
|
||
# this has to be a global else amplify craps out don't ask. | ||
# i guess there's probably a way to have yarn not install it if not needed | ||
# but this is quite a bit faster than using `yarn list --patern amplify` | ||
- run: "if [ -e $HOME/.yarn/bin/amplify ]; then echo 'amplify already installed globally, skipping'; else yarn global add @aws-amplify/cli@multienv; fi" | ||
- run: yarn | ||
|
||
- save_cache: | ||
paths: | ||
- node_modules | ||
# capture globally installed amplify CLI...it doesn't work | ||
# when executing it locally via node_modules/.bin/amplify so w/e | ||
- ~/.yarn | ||
# previous one symlinks into here | ||
- ~/.config/yarn | ||
key: node-v1-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }} | ||
|
||
# amplify doesn't presently support creds as environment variables so | ||
# we write ~/.aws/credentials based on environment variables. ok sure | ||
- run: ./script/write_aws_creds_file.sh | ||
- run: ./script/amplify_init.sh | ||
- run: ~/.yarn/bin/amplify env checkout staging | ||
- run: ~/.yarn/bin/amplify publish -y | ||
|
||
workflows: | ||
version: 2 | ||
deployToStagingAndTest: | ||
jobs: | ||
- deployToStaging | ||
# at first we will deploy everything but really this should be just for | ||
# PRs against master; uncomment this. | ||
# branches: | ||
# ignore: | ||
# - master |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SKIP_PREFLIGHT_CHECK=true |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"staging": { | ||
"configLevel": "project", | ||
"useProfile": true, | ||
"profileName": "amplify" | ||
}, | ||
"prod": { | ||
"configLevel": "project", | ||
"useProfile": true, | ||
"profileName": "amplify" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"projectPath": "/Users/stuartsan/dev/lighthouse-circleci-example", | ||
"envName": "staging" | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
set -e | ||
IFS='|' | ||
|
||
REACTCONFIG="{\ | ||
\"SourceDir\":\"src\",\ | ||
\"DistributionDir\":\"build\",\ | ||
\"BuildCommand\":\"npm run-script build\",\ | ||
\"StartCommand\":\"npm run-script start\"\ | ||
}" | ||
AWSCLOUDFORMATIONCONFIG="{\ | ||
\"configLevel\":\"project\",\ | ||
\"useProfile\":true,\ | ||
\"profileName\":\"amplify\",\ | ||
\"region\":\"us-west-2\"\ | ||
}" | ||
AMPLIFY="{\ | ||
\"projectName\":\"lighthousecircleciex\",\ | ||
\"defaultEditor\":\"code\"\ | ||
}" | ||
FRONTEND="{\ | ||
\"frontend\":\"javascript\",\ | ||
\"framework\":\"react\",\ | ||
\"config\":$REACTCONFIG\ | ||
}" | ||
PROVIDERS="{\ | ||
\"awscloudformation\":$AWSCLOUDFORMATIONCONFIG\ | ||
}" | ||
|
||
~/.yarn/bin/amplify configure project \ | ||
--amplify $AMPLIFY \ | ||
--frontend $FRONTEND \ | ||
--providers $PROVIDERS \ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p ~/.aws/ | ||
|
||
cat <<EOF > ~/.aws/credentials | ||
[amplify] | ||
aws_access_key_id=$AWS_ACCESS_KEY_AMPLIFY | ||
aws_secret_access_key=$AWS_SECRET_KEY_AMPLIFY | ||
EOF | ||
|
||
cat <<EOF > ~/.aws/config | ||
[profile amplify] | ||
region=us-west-2 | ||
EOF |
Oops, something went wrong.