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 33 push :
44 branches :
55 - 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
612jobs :
713 push_to_registry :
814 environment : staging
2531 file : ./Dockerfile
2632 pull : true
2733 push : true
28- tags : ${{ secrets.DOCKER_USERNAME }}/p5.js-web-editor-staging:${{ github.sha }}
34+ tags : |
35+ $IMAGE:${{ github.sha }}
36+ $IMAGE:latest
2937 target : production
38+ # Setup gcloud CLI
39+ - uses : google-github-actions/setup-gcloud@v0.2.0
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/get-gke-credentials@v0.2.1
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
3068
You can’t perform that action at this time.
0 commit comments