Skip to content

Commit 9d49a8b

Browse files
authored
Create deploy-website
1 parent 2d9c273 commit 9d49a8b

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/deploy-website

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy Website to Cloud Run
2+
3+
on:
4+
push:
5+
paths:
6+
- website/**
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 Website Docker image
32+
run: |
33+
docker build -t gcr.io/summit-enterprise-workshop/${{github.actor}}-website:latest .
34+
docker images
35+
working-directory: ./website
36+
37+
- name: Push Docker image to Google Container Registry
38+
run: |
39+
docker push gcr.io/summit-enterprise-workshop/${{github.actor}}-website:latest
40+
working-directory: ./website
41+
42+
- name: Deploy Website to Cloud Run
43+
run: |
44+
gcloud run deploy ${{github.actor}}-orders \
45+
--image gcr.io/summit-enterprise-workshop/${{github.actor}}-website: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}}-website --region us-central1 --format 'value(status.url)' > url.json
53+
echo "::notice URL=$(cat url.json)"

0 commit comments

Comments
 (0)