Skip to content

Commit 8d534d6

Browse files
author
Keith Halsall
committed
Update scripts to support contract router creation in studio and deployment to cloud run
1 parent 925978f commit 8d534d6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.github/workflows/deploy-router.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ jobs:
3737
--set-env-vars "APOLLO_ROUTER_HOT_RELOAD=true,APOLLO_KEY=${{ vars.TOKEN }},APOLLO_GRAPH_REF=${{vars.ACTOR}}${{env.GEN}}@current" --platform managed --region us-central1 \
3838
--allow-unauthenticated
3939
40+
- name: Deploy contract router to Cloud Run
41+
run: |
42+
gcloud run deploy ${{vars.ACTOR}}-contractRouter --image gcr.io/summit-enterprise-workshop/jesse-apollo-router:latest \
43+
--set-secrets=/dist/config/router.yaml=${{vars.ACTOR}}:latest \
44+
--set-env-vars "APOLLO_ROUTER_HOT_RELOAD=true,APOLLO_KEY=${{ vars.TOKEN }},APOLLO_GRAPH_REF=${{vars.ACTOR}}${{env.GEN}}@public" --platform managed --region us-central1 \
45+
--allow-unauthenticated

.github/workflows/setup.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ jobs:
3636
--header 'content-type: application/json' \
3737
--header 'X-API-Key: ${{ secrets.APOLLO_USER_KEY }}' \
3838
--data '{"query":"mutation Mutation($accountId: ID!, $graphType: GraphType!, $hiddenFromUninvitedNonAdmin: Boolean!, $createGraphId: ID!, $title: String!, $variantCreationConfig: VariantCreationConfig) {\n account(id: $accountId) {\n createGraph(graphType: $graphType, hiddenFromUninvitedNonAdmin: $hiddenFromUninvitedNonAdmin, id: $createGraphId, title: $title, variantCreationConfig: $variantCreationConfig) {\n __typename\n ... on Service {\n __typename\n id\n }\n ... on GraphCreationError {\n __typename\n message\n }\n }\n }\n}","variables":{"accountId":"${{ secrets.APOLLO_ACCOUNT }}","graphType":"SELF_HOSTED_SUPERGRAPH","hiddenFromUninvitedNonAdmin":false,"createGraphId":"${{env.ACTOR}}${{ env.GEN }}","title":"${{env.ACTOR}} - ${{ env.GEN }}","variantCreationConfig":{"variantName":"current","buildConfigInput":{"apiDirectivePassThrough":[],"buildPipelineTrack":null,"composition":{"subgraphs":[]}}}}}'
39+
40+
- name: Create Empty Contract in Apollo Studio
41+
run: |
42+
curl --request POST 'https://graphql.api.apollographql.com/api/graphql' \
43+
--header 'content-type: application/json' \
44+
--header 'X-API-Key: ${{ secrets.APOLLO_USER_KEY }}' \
45+
--data '{"query":"mutation Mutation($graphId: ID!, $contractVariantName: String!, $sourceVariant: String, $initiateLaunch: Boolean!, $filterConfig: FilterConfigInput!) {\n graph(id: $graphId) {\n upsertContractVariant(contractVariantName: $contractVariantName, sourceVariant: $sourceVariant, initiateLaunch: $initiateLaunch, filterConfig: $filterConfig) {\n ... on ContractVariantUpsertSuccess {\n contractVariant {\n name\n id\n }\n }\n }\n }\n}","variables":{"graphId":"${{env.ACTOR}}${{ env.GEN }}","contractVariantName":"Public","sourceVariant":"${{env.ACTOR}}${{ env.GEN }}@current","initiateLaunch":true,"filterConfig":{"exclude":[],"hideUnreachableTypes":false,"include":[]}}}'
3946
4047
keys:
4148
needs: create

0 commit comments

Comments
 (0)