-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (48 loc) · 1.88 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: churn-prediction-service
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Google Cloud SDK
run: |
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud --version
- name: Authenticate with Google Cloud
run: |
# echo "${{secrets.GKE_SECRET_CPS}}"
echo "${{ secrets.GKE_SECRET_CPS }}" > gcp-sa-key.json
cat gcp-sa-key.json
gcloud auth activate-service-account --key-file=gcp-sa-key.json
env:
GOOGLE_APPLICATION_CREDENTIALS: gcp-sa-key.json
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@main
with:
project_id: neemar
# service_account_key: ${{ secrets.GKE_SECRET_CPS }}
# export_default_credentials: true
- name: Let's copy gcp credentials
run: echo "${{secrets.GKE_SECRET_CPS}}" > gcp_credentials.json
- name: Configure Docker to use GCR
run: |
gcloud auth configure-docker
- name: Grant Storage Object Viewer Role
run: |
gcloud projects add-iam-policy-binding data-science-project --member=serviceAccount:sample-service-account@data-science-project-418009.iam.gserviceaccount.com --role=roles/storage.objectViewer
- name: Build and Push Docker image
run: |
docker build -t gcr.io/neemar/churn-prediction-service:${{ github.sha }} .
docker push gcr.io/neemar/churn-prediction-service:${{ github.sha }}
- name: Configure kubectl
run: |
gcloud container clusters get-credentials autopilot-cluster-1 --zone asia-south1 --project data-science-project
- name: Deploy to GKE
run: |
kubectl apply -f ./github/workflows/deploy.yaml