Skip to content

Commit 1d829e0

Browse files
author
Keith Halsall
committed
Changes to support updating README to add Website URL
1 parent 52ae621 commit 1d829e0

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

.github/workflows/create_studio_project.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ jobs:
9090
--url 'https://graphql.api.apollographql.com/api/graphql' \
9191
--data '{"query":"mutation Mutation($graphId: ID!, $name: String!, $subscriptionUrl: String) {\n graph(id: $graphId) {\n variant(name: $name) {\n updateSubscriptionURL(subscriptionUrl: $subscriptionUrl) {\n createdAt\n }\n }\n }\n}","variables":{"graphId":"${{vars.ACTOR}}-${{vars.WORKSHOPID}}${{ env.GEN }}","name":"current","subscriptionUrl":"${{ env.URL }}"}}'
9292
93+
deployWebsite:
94+
needs: install-url
95+
uses: ./.github/workflows/deploy-website.yml
96+
secrets: inherit
97+
9398
preflightScript:
9499
needs: publish
95100
runs-on: ubuntu-latest

.github/workflows/deploy-website.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
with:
2121
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
2222

23-
- name: Set up Google Cloud SDK
24-
uses: google-github-actions/setup-gcloud@v0
25-
2623
- name: Configure Docker to use gcloud as a credential helper
2724
run: |
2825
gcloud auth configure-docker
@@ -31,7 +28,7 @@ jobs:
3128
run: |
3229
docker build -t gcr.io/summit-enterprise-workshop/${{github.actor}}-${{vars.WORKSHOPID}}-website:latest .
3330
docker images
34-
working-directory: .final/website
31+
working-directory: ./final/website
3532

3633
- name: Push Docker image to Google Container Registry
3734
run: |
@@ -49,28 +46,17 @@ jobs:
4946
--image gcr.io/summit-enterprise-workshop/${{github.actor}}-${{vars.WORKSHOPID}}-website:latest \
5047
--platform managed \
5148
--region us-central1 \
52-
--update-env-vars APOLLO_KEY=${{ secrets.APOLLO_KEY }},APOLLO_GRAPH_REF=${{ secrets.APOLLO_GRAPH_REF }}, ROUTER_URL=${{env.url}} \
49+
--update-env-vars APOLLO_KEY=${{ secrets.APOLLO_KEY }},APOLLO_GRAPH_REF=${{ secrets.APOLLO_GRAPH_REF }},ROUTER_URL=${{env.url}} \
5350
--allow-unauthenticated
5451
- name: Get URL
5552
run: |
5653
gcloud run services describe ${{vars.ACTOR}}-${{vars.WORKSHOPID}}-website --region us-central1 --format 'value(status.url)' > url.json
5754
echo "webURL=$(cat url.json)" >> $GITHUB_ENV
5855
59-
- name: Get current README to update
60-
run: |
61-
curl --request POST \
62-
--header 'content-type: application/json' \
63-
--header 'X-API-Key: user:fp.d88ba77d-487c-4b97-9780-f1e4c5352a22:ftuXT6T7OktKoMaUZhQwSw' \
64-
--url 'https://graphql.api.apollographql.com/api/graphql' \
65-
--data '{"query":"query Query($ref: ID!) {\n variant(ref: $ref) {\n ... on GraphVariant {\n readme {\n content\n }\n }\n }\n}","variables":{"ref":"${{vars.ACTOR}}-${{vars.WORKSHOPID}}${{env.GEN}}"}}' -o readme.json
66-
67-
- name: Set Env
68-
run: echo "CONTENT=$(cat readme.json | jq .data.variant.readme.content)" >> $GITHUB_ENV
69-
7056
- name: Update README
7157
run: |
7258
curl --request POST \
7359
--header 'content-type: application/json' \
7460
--header 'X-API-Key: user:fp.d88ba77d-487c-4b97-9780-f1e4c5352a22:ftuXT6T7OktKoMaUZhQwSw' \
7561
--url 'https://graphql.api.apollographql.com/api/graphql' \
76-
--data '{"query":"mutation Mutation($graphId: ID!, $name: String!, $readme: String!) {\n graph(id: $graphId) {\n variant(name: $name) {\n updateVariantReadme(readme: $readme) {\n readme {\n content\n }\n }\n }\n }\n}","variables":{"graphId":"${{vars.ACTOR}}-${{vars.WORKSHOPID}}${{env.GEN}}","name":"current","readme":"${{env.CONTENT}} \n###WEBSITE URL \n ${{env.webURL}}"}}'
62+
--data '{"query":"mutation Mutation($graphId: ID!, $name: String!, $readme: String!) {\n graph(id: $graphId) {\n variant(name: $name) {\n updateVariantReadme(readme: $readme) {\n readme {\n content\n }\n }\n }\n }\n}","variables":{"graphId":"${{vars.ACTOR}}-${{vars.WORKSHOPID}}${{env.GEN}}","name":"current","readme":"# Getting started\nWelcome to the **{{ graph.name }}** API! 🎉 Get familiar with available objects in the [Schema Reference]({{ graph.url.reference }}), or try querying this graph using [Explorer]({{ graph.url.explorer }}).\n\nThis is the default README content. You can customize it however you like. Graph Maintainers, you can edit to include any information that is relevant for developers working with this graph by clicking the pencil icon in the top right corner. ☝\n\n## What this graph is all about\n\nDescribe the purpose and use cases for your graph here. This is where you can tell the story of your API, and all of its deep magic...🦄🌌✨\n\n## Accessing the graph\n\n🛰 You can send operations to this graph at `{{ graph.url.endpoint }}`\n\n📇 The Apollo Registry holds the canonical location of your schema. In the registry, this graph is referred to by its “graph ref”, which is: **{{ graph.ref }}**.\n\n*(Note: you can [download Rover](https://www.apollographql.com/docs/rover/getting-started/), the Apollo CLI tool for working with your schema locally.)*\n\n## How to authenticate to this graph\nAuthentication information has not been added to this README yet. Be sure to let your API developers know how to authenticate, and where to find the auth tokens they’ll need to authenticate with.🔐 👀\n\n## Running operations\nInclude some operations in your README to help your API developers get started with your graph. Using a code block designated as ````gql` will render the operation with the Run in Explorer mini-button, and will load the operation in Explorer when clicked!\n\n```gql\nquery Query {\n\tid\n}\n```\n\n### Getting help with this graph\nFor support working with this graph, contact the Graph Admin via [email(replace me)](mailto:[email protected]) or [chat(put your chat link here)](#chatlink).\n\n###WEBSITE URL \n ${{env.webURL}}"}}'

0 commit comments

Comments
 (0)