@@ -16,18 +16,22 @@ jobs:
1616 - name : Checkout code
1717 uses : actions/checkout@v2
1818
19- - name : Set up Google Cloud CLI
20- uses : google-github-actions/setup-gcloud@v2 # Updated to v2
19+ - name : Google Cloud Auth # Authenticate gcloud CLI
20+ uses : google-github-actions/auth@ v2
2121 with :
22- service_account_key : ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
22+ credentials_json : ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
23+
24+ - name : Set up Google Cloud CLI # Set up gcloud CLI and Docker
25+ uses : google-github-actions/setup-gcloud@v2
26+ with :
27+ version : latest
2328 project_id : ${{ secrets.GOOGLE_PROJECT }}
24- export_default_credentials : true
2529
26- - name : Configure Docker to push to Artifact Registry
30+ - name : Configure Docker to push to Artifact Registry # Configure docker auth
2731 run : |
2832 gcloud auth configure-docker us-central1-docker.pkg.dev
2933
30- - name : Build and Push Docker image to Artifact Registry
34+ - name : Build and Push Docker image to Artifact Registry # Build and push image
3135 env :
3236 GOOGLE_PROJECT : ${{ secrets.GOOGLE_PROJECT }}
3337 IMAGE_NAME : us-central1-docker.pkg.dev/${{ secrets.GOOGLE_PROJECT }}/flex-net-sim-repo/fns-api
@@ -36,18 +40,18 @@ jobs:
3640 docker build -t $IMAGE_NAME:$IMAGE_TAG .
3741 docker push $IMAGE_NAME:$IMAGE_TAG
3842
39- - name : Get Kubernetes cluster credentials
43+ - name : Get Kubernetes cluster credentials # Get cluster credentials
4044 env :
4145 GOOGLE_PROJECT : ${{ secrets.GOOGLE_PROJECT }}
4246 CLUSTER_NAME : flex-net-sim-cluster
4347 CLUSTER_REGION : us-central1
4448 run : |
4549 gcloud container clusters get-credentials $CLUSTER_NAME --region $CLUSTER_REGION --project $GOOGLE_PROJECT
4650
47- - name : Deploy to Kubernetes cluster
51+ - name : Deploy to Kubernetes cluster # Deploy to cluster
4852 env :
4953 DEPLOYMENT_NAME : fns-api-deployment
50- NAMESPACE : default
54+ NAMESPACE : default # Replace with your namespace if needed
5155 IMAGE_NAME : us-central1-docker.pkg.dev/${{ secrets.GOOGLE_PROJECT }}/flex-net-sim-repo/fns-api
5256 IMAGE_TAG : latest
5357 run : |
0 commit comments