-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad569d5
commit ce4e516
Showing
1 changed file
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ jobs: | |
- name: Setup Google Cloud SDK | ||
uses: google-github-actions/[email protected] | ||
with: | ||
project_id: ${{ env.GKE_PROJECT }} | ||
project_id: ${{ env.PROJECT_ID }} | ||
service_account_key: ${{ env.SERVICE_ACCOUNT_KEY }} | ||
|
||
- name: Authenticate to Google Cloud | ||
|
@@ -102,7 +102,7 @@ jobs: | |
if [ "$SERVICE_NAME" != "blogs-analyzer-ui" ]; then | ||
mvn clean install -DskipTests | ||
fi | ||
IMAGE_NAME=gcr.io/gen-lang-client-0999974873/$SERVICE_NAME:$COMMIT_SHA | ||
IMAGE_NAME=gcr.io/${{ env.PROJECT_ID }}/$SERVICE_NAME:$COMMIT_SHA | ||
docker build -t $IMAGE_NAME . | ||
docker push $IMAGE_NAME | ||
cd .. | ||
|
@@ -112,14 +112,14 @@ jobs: | |
- name: Deploy to GKE | ||
run: | | ||
echo "Getting credentials for cluster ${{ env.CLUSTER_NAME }} in zone ${{ env.REGION }}" | ||
gcloud container clusters get-credentials blogs-analyzer-cluster --region asia-south1 --project gen-lang-client-0999974873 | ||
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --region ${{ env.REGION }} --project ${{ env.PROJECT_ID }} | ||
COMMIT_SHA=$(git rev-parse --short HEAD) | ||
SERVICE_NAMES=$(cat projects-changes-deploy.txt) | ||
echo "Service Names: $SERVICE_NAMES" | ||
for SERVICE_NAME in $(echo $SERVICE_NAMES | tr ',' ' '); do | ||
echo "Deploying $SERVICE_NAME to GKE" | ||
if [ -d "$SERVICE_NAME/k8s" ]; then | ||
sed -i "s|gcr.io/gen-lang-client-0999974873/$SERVICE_NAME:latest|gcr.io/gen-lang-client-0999974873/$SERVICE_NAME:$COMMIT_SHA|g" $SERVICE_NAME/k8s/deployment.yaml | ||
if [ -d "$SERVICE_NAME/k8s" ]; then | ||
sed -i "s|gcr.io/${{ env.PROJECT_ID }}/$SERVICE_NAME:latest|gcr.io/${{ env.PROJECT_ID }}/$SERVICE_NAME:$COMMIT_SHA|g" $SERVICE_NAME/k8s/deployment.yaml | ||
kubectl apply -f $SERVICE_NAME/k8s/ | ||
fi | ||
done |