Skip to content

Commit

Permalink
Merge pull request #964 from CruGlobal/previews-on-amplify
Browse files Browse the repository at this point in the history
MPDX-7999 - Fix Amplify previews build
  • Loading branch information
dr-bizz authored Jun 24, 2024
2 parents eb907de + 8de6e05 commit f64dd8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
13 changes: 8 additions & 5 deletions amplify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ frontend:
- nvm install 18.13
- nvm use 18.13
- |
if [[ "${AWS_BRANCH_ARN#*/branches/}" == *"pr-"* ]]; then
PREVIEW_URL="https://${AWS_BRANCH_ARN#*/branches/}.${AWS_APP_ID}.amplifyapp.com";
NEXTAUTH_URL=$PREVIEW_URL;
echo "PREVIEW_URL=$PREVIEW_URL" >> .env;
elif [[ "${AWS_BRANCH}" != "main" && "${AWS_BRANCH}" != "staging" ]]; then
if [[ "${AWS_BRANCH}" != "main" && "${AWS_BRANCH}" != "staging" ]]; then
PREVIEW_URL="https://${AWS_BRANCH}.${AWS_APP_ID}.amplifyapp.com";
NEXTAUTH_URL=$PREVIEW_URL;
echo "PREVIEW_URL=$PREVIEW_URL" >> .env;
export API_URL=https://api.mpdx.org/graphql
export REST_API_URL=https://api.mpdx.org/api/v2/
fi
- echo "NEXTAUTH_URL=$NEXTAUTH_URL" >> .env
- echo "NODE_ENV=$NODE_ENV" >> .env
Expand All @@ -23,6 +21,11 @@ frontend:
- yarn
- yarn disable-telemetry
- yarn gql
- |
if [[ "${AWS_BRANCH}" != "main" && "${AWS_BRANCH}" != "staging" ]]; then
export API_URL=https://api.stage.mpdx.org/graphql
export REST_API_URL=https://api.stage.mpdx.org/api/v2/
fi
build:
commands:
- yarn build:amplify
Expand Down
12 changes: 6 additions & 6 deletions codegen.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
generates:
./src/graphql/types.generated.ts:
schema:
- ${API_URL:https://api.stage.mpdx.org/graphql}
- ${API_URL:https://api.mpdx.org/graphql}
- ./pages/api/Schema/**/*.graphql
plugins:
- typescript
Expand All @@ -11,7 +11,7 @@ generates:
ISO8601DateTime: string
./:
schema:
- ${API_URL:https://api.stage.mpdx.org/graphql}
- ${API_URL:https://api.mpdx.org/graphql}
- ./pages/api/Schema/**/*.graphql
documents: '**/*.graphql'
preset: near-operation-file
Expand All @@ -24,19 +24,19 @@ generates:
preResolveTypes: false
./src/graphql/schema.graphql:
schema:
- ${API_URL:https://api.stage.mpdx.org/graphql}
- ${API_URL:https://api.mpdx.org/graphql}
- ./pages/api/Schema/**/*.graphql
plugins:
- schema-ast
./src/graphql/possibleTypes.generated.ts:
schema:
- ${API_URL:https://api.stage.mpdx.org/graphql}
- ${API_URL:https://api.mpdx.org/graphql}
- ./pages/api/Schema/**/*.graphql
plugins:
- fragment-matcher
./pages/api/graphql-rest.page.generated.ts:
schema:
- ${API_URL:https://api.stage.mpdx.org/graphql}
- ${API_URL:https://api.mpdx.org/graphql}
- ./pages/api/Schema/**/*.graphql
plugins:
- typescript
Expand All @@ -48,7 +48,7 @@ generates:
ISO8601Date: string
ISO8601DateTime: string
./src/graphql/rootFields.generated.ts:
schema: ${API_URL:https://api.stage.mpdx.org/graphql}
schema: ${API_URL:https://api.mpdx.org/graphql}
plugins:
- ./extractRootFields.js
hooks:
Expand Down

0 comments on commit f64dd8a

Please sign in to comment.