Created
September 25, 2020 05:58
-
-
Save superjose/0367fb13898640eefae8ac219d255cb0 to your computer and use it in GitHub Desktop.
AWS Amplify Monorepo - amplify.yml - create react app
This file contains hidden or 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
| version: 1 | |
| applications: | |
| - appRoot: app | |
| env: | |
| variables: | |
| SKIP_PREFLIGHT_CHECK: true | |
| DEV_REACT_APP_APPSYNC_API_ID: replace_with_your_value | |
| DEV_REACT_APP_APPSYNC_URL: replace_with_your_value | |
| DEV_REACT_APP_AUTH0_CALLBACK_URL: replace_with_your_value | |
| DEV_REACT_APP_AUTH0_RETURN_TO_URL: replace_with_your_value | |
| DEV_REACT_APP_AUTH0_CLIENT_ID: replace_with_your_value | |
| DEV_REACT_APP_AUTH0_DOMAIN: replace_with_your_value | |
| DEV_REACT_APP_ROLE_ARN: replace_with_your_value | |
| DEV_REACT_APP_S3_UPLOAD_BUCKET: replace_with_your_value | |
| PROD_REACT_APP_APPSYNC_API_ID: replace_with_your_value | |
| PROD_REACT_APP_APPSYNC_URL: replace_with_your_value | |
| PROD_REACT_APP_AUTH0_CALLBACK_URL: replace_with_your_value | |
| PROD_REACT_APP_AUTH0_RETURN_TO_URL: replace_with_your_value | |
| PROD_REACT_APP_AUTH0_CLIENT_ID: replace_with_your_value | |
| PROD_REACT_APP_AUTH0_DOMAIN: replace_with_your_value | |
| PROD_REACT_APP_ROLE_ARN: replace_with_your_value | |
| PROD_REACT_APP_S3_UPLOAD_BUCKET: replace_with_your_value | |
| frontend: | |
| phases: | |
| preBuild: | |
| commands: | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_APPSYNC_API_ID=${DEV_REACT_APP_APPSYNC_API_ID}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_APPSYNC_URL=${DEV_REACT_APP_APPSYNC_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_AUTH0_CALLBACK_URL=${DEV_REACT_APP_AUTH0_CALLBACK_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_AUTH0_CLIENT_ID=${DEV_REACT_APP_AUTH0_CLIENT_ID}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_AUTH0_DOMAIN=${DEV_REACT_APP_AUTH0_DOMAIN}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_AUTH0_RETURN_TO_URL=${DEV_REACT_APP_AUTH0_RETURN_TO_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_ROLE_ARN=${DEV_REACT_APP_ROLE_ARN}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_S3_UPLOAD_BUCKET=${DEV_REACT_APP_S3_UPLOAD_BUCKET}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_APPSYNC_API_ID=${PROD_REACT_APP_APPSYNC_API_ID}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_APPSYNC_URL=${PROD_REACT_APP_APPSYNC_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_AUTH0_CALLBACK_URL=${PROD_REACT_APP_AUTH0_CALLBACK_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_AUTH0_CLIENT_ID=${PROD_REACT_APP_AUTH0_CLIENT_ID}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_AUTH0_DOMAIN=${PROD_REACT_APP_AUTH0_DOMAIN}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_AUTH0_RETURN_TO_URL=${PROD_REACT_APP_AUTH0_RETURN_TO_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_ROLE_ARN=${PROD_REACT_APP_ROLE_ARN}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_S3_UPLOAD_BUCKET=${PROD_REACT_APP_S3_UPLOAD_BUCKET}; fi | |
| - yarn install | |
| - yarn lint | |
| - yarn test | |
| build: | |
| commands: | |
| - yarn build | |
| artifacts: | |
| baseDirectory: build | |
| files: | |
| - '**/*' | |
| cache: | |
| paths: | |
| - node_modules/**/* | |
| - appRoot: home | |
| env: | |
| variables: | |
| SKIP_PREFLIGHT_CHECK: true | |
| DEV_REACT_APP_APPSYNC_API_ID: replace_with_your_value | |
| DEV_REACT_APP_APPSYNC_URL: replace_with_your_value | |
| DEV_REACT_APP_AUTH0_CALLBACK_URL: replace_with_your_value | |
| DEV_REACT_APP_AUTH0_RETURN_TO_URL: replace_with_your_value | |
| DEV_REACT_APP_AUTH0_CLIENT_ID: replace_with_your_value | |
| DEV_REACT_APP_AUTH0_DOMAIN: replace_with_your_value | |
| DEV_REACT_APP_ROLE_ARN: replace_with_your_value | |
| DEV_REACT_APP_S3_UPLOAD_BUCKET: replace_with_your_value | |
| PROD_REACT_APP_APPSYNC_API_ID: replace_with_your_value | |
| PROD_REACT_APP_APPSYNC_URL: replace_with_your_value | |
| PROD_REACT_APP_AUTH0_CALLBACK_URL: replace_with_your_value | |
| PROD_REACT_APP_AUTH0_RETURN_TO_URL: replace_with_your_value | |
| PROD_REACT_APP_AUTH0_CLIENT_ID: replace_with_your_value | |
| PROD_REACT_APP_AUTH0_DOMAIN: replace_with_your_value | |
| PROD_REACT_APP_ROLE_ARN: replace_with_your_value | |
| PROD_REACT_APP_S3_UPLOAD_BUCKET: replace_with_your_value | |
| frontend: | |
| phases: | |
| preBuild: | |
| commands: | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_APPSYNC_API_ID=${DEV_REACT_APP_APPSYNC_API_ID}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_APPSYNC_URL=${DEV_REACT_APP_APPSYNC_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_AUTH0_CALLBACK_URL=${DEV_REACT_APP_AUTH0_CALLBACK_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_AUTH0_CLIENT_ID=${DEV_REACT_APP_AUTH0_CLIENT_ID}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_AUTH0_DOMAIN=${DEV_REACT_APP_AUTH0_DOMAIN}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_AUTH0_RETURN_TO_URL=${DEV_REACT_APP_AUTH0_RETURN_TO_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_ROLE_ARN=${DEV_REACT_APP_ROLE_ARN}; fi | |
| - if [ "${AWS_BRANCH}" = "master" ]; then export REACT_APP_S3_UPLOAD_BUCKET=${DEV_REACT_APP_S3_UPLOAD_BUCKET}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_APPSYNC_API_ID=${PROD_REACT_APP_APPSYNC_API_ID}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_APPSYNC_URL=${PROD_REACT_APP_APPSYNC_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_AUTH0_CALLBACK_URL=${PROD_REACT_APP_AUTH0_CALLBACK_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_AUTH0_CLIENT_ID=${PROD_REACT_APP_AUTH0_CLIENT_ID}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_AUTH0_DOMAIN=${PROD_REACT_APP_AUTH0_DOMAIN}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_AUTH0_RETURN_TO_URL=${PROD_REACT_APP_AUTH0_RETURN_TO_URL}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_ROLE_ARN=${PROD_REACT_APP_ROLE_ARN}; fi | |
| - if [ "${AWS_BRANCH}" = "prod" ]; then export REACT_APP_S3_UPLOAD_BUCKET=${PROD_REACT_APP_S3_UPLOAD_BUCKET}; fi | |
| - yarn install | |
| - yarn lint | |
| - yarn test | |
| build: | |
| commands: | |
| - yarn build | |
| artifacts: | |
| baseDirectory: build | |
| files: | |
| - '**/*' | |
| cache: | |
| paths: | |
| - node_modules/**/* |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a properly formatted example of a working amplify.yml for monorepos.
This has 2 create-react-app in 2 sibling folders, and one common
componentsfolder which the code is shared (Note that the sharedcomponentsfolder is not specified in the .yml.Please note the following:
artifactskey is at the same level as thephasesone.appandhomeare at the root level directory of my repo. Remember to respect paths. They do not necessarily need to be in root,file:../directive.Here's my folder structure

Other notes:
There was an issue connecting to your repo provider, click "Re-authenticate app" in General Settings, and then try your build again.It's a YAML formatting error. You do not need to re-authenticate your app again.