File tree Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change 3
3
push :
4
4
branches :
5
5
- chore/github-actions
6
+ env :
7
+ PROJECT_ID : ${{ secrets.GKE_PROJECT }}
8
+ GKE_CLUSTER : p5js-web-editor-cluster
9
+ GKE_ZONE : us-east1-c
10
+ DEPLOYMENT_NAME : web-editor-node
11
+ IMAGE : ${{ secrets.DOCKER_USERNAME }}/p5.js-web-editor-staging
6
12
jobs :
7
13
push_to_registry :
8
14
environment : staging
25
31
file : ./Dockerfile
26
32
pull : true
27
33
push : true
28
- tags : ${{ secrets.DOCKER_USERNAME }}/p5.js-web-editor-staging:${{ github.sha }}
34
+ tags : |
35
+ $IMAGE:${{ github.sha }}
36
+ $IMAGE:latest
29
37
target : production
38
+ # Setup gcloud CLI
39
+ -
uses :
google-github-actions/[email protected]
40
+ with :
41
+ service_account_key : ${{ secrets.GKE_SA_KEY }}
42
+ project_id : ${{ secrets.GKE_PROJECT }}
43
+
44
+ # Configure docker to use the gcloud command-line tool as a credential helper
45
+ - run : |-
46
+ gcloud --quiet auth configure-docker
47
+
48
+ # Get the GKE credentials so we can deploy to the cluster
49
+ -
uses :
google-github-actions/[email protected]
50
+ with :
51
+ cluster_name : ${{ env.GKE_CLUSTER }}
52
+ location : ${{ env.GKE_ZONE }}
53
+ credentials : ${{ secrets.GKE_SA_KEY }}
54
+
55
+ # Set up kustomize
56
+ - name : Set up Kustomize
57
+ run : |-
58
+ curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
59
+ chmod u+x ./kustomize
60
+
61
+ # Deploy the Docker image to the GKE cluster
62
+ - name : Deploy
63
+ run : |-
64
+ ./kustomize edit set image web-editor-app=index.docker.io/$IMAGE:$GITHUB_SHA --namespace=staging
65
+ ./kustomize build . | kubectl apply -f -
66
+ kubectl rollout status deployment/$DEPLOYMENT_NAME --namespace=staging
67
+ kubectl get services -o wide --namespace=staging
30
68
You can’t perform that action at this time.
0 commit comments