Skip to content

Commit 836323b

Browse files
author
Keith Halsall
committed
Create deploy orders script
1 parent c2cd0da commit 836323b

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/deploy-orders.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy Orders to Cloud Run
2+
3+
on:
4+
push:
5+
paths:
6+
- rest-orders/**
7+
8+
env:
9+
GEN: "workshop"
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- id: "auth"
20+
uses: "google-github-actions/auth@v0"
21+
with:
22+
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
23+
24+
- name: Set up Google Cloud SDK
25+
uses: google-github-actions/setup-gcloud@v0
26+
27+
- name: Configure Docker to use gcloud as a credential helper
28+
run: |
29+
gcloud auth configure-docker
30+
31+
- name: Build Order Subgraph Docker image
32+
run: |
33+
docker build -t gcr.io/summit-enterprise-workshop/${{github.actor}}-orders:latest .
34+
docker images
35+
working-directory: ./rest-orders
36+
37+
- name: Push Docker image to Google Container Registry
38+
run: |
39+
docker push gcr.io/summit-enterprise-workshop/${{github.actor}}-orders:latest
40+
working-directory: ./rest-orders
41+
42+
- name: Deploy Orders subgraph to Cloud Run
43+
run: |
44+
gcloud run deploy ${{github.actor}}-orders \
45+
--image gcr.io/summit-enterprise-workshop/${{github.actor}}-orders:latest \
46+
--platform managed \
47+
--region us-central1 \
48+
--update-env-vars APOLLO_KEY=${{ secrets.APOLLO_KEY }},APOLLO_GRAPH_REF=${{ secrets.APOLLO_GRAPH_REF }} \
49+
--allow-unauthenticated
50+
- name: Get URL
51+
run: |
52+
gcloud run services describe ${{vars.ACTOR}}-orders --region us-central1 --format 'value(status.url)' > url.json
53+
echo "URL=$(cat url.json)" >> $GITHUB_ENV
54+
- name: Rover Subgraph Publish Orders
55+
run: |
56+
rover subgraph publish ${{vars.ACTOR}}${{ env.GEN }}@current \
57+
--name orders \
58+
--routing-url ${{ env.URL }} \
59+
--schema ./rest-orders/schema.graphql
60+

0 commit comments

Comments
 (0)