Skip to content

Commit

Permalink
fix env
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuldeep-knoldus committed Jun 27, 2024
1 parent 57de7d8 commit 433f2ed
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
CLUSTER_NAME: blogs-analyzer-cluster
REGION: ${{ secrets.GKE_ZONE }}
REGISTRY_NAME: blogs-analyzer
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

jobs:
build:
Expand Down Expand Up @@ -80,14 +81,14 @@ jobs:
- name: Setup Google Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: ${{ secrets.GKE_PROJECT }}
service_account_key: ${{ secrets.SERVICE_ACCOUNT_KEY }}
project_id: ${{ env.GKE_PROJECT }}
service_account_key: ${{ env.SERVICE_ACCOUNT_KEY }}

- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }}
credentials_json: ${{ env.SERVICE_ACCOUNT_KEY }}

- name: Configure Docker for Google Container Registry
run: gcloud auth configure-docker
Expand All @@ -100,7 +101,7 @@ jobs:
echo "Building and pushing Docker image for $SERVICE_NAME"
if [ -d "$SERVICE_NAME" ]; then
cd $SERVICE_NAME
IMAGE_NAME=gcr.io/gen-lang-client-0999974873/$SERVICE_NAME:latest
IMAGE_NAME=gcr.io/${{ env.GKE_PROJECT }}/$SERVICE_NAME:latest
docker build -t $IMAGE_NAME .
docker push $IMAGE_NAME
cd ..
Expand All @@ -109,7 +110,7 @@ jobs:
- name: Deploy to GKE
run: |
gcloud container clusters get-credentials ${{ secrets.CLUSTER_NAME }} --zone ${{ secrets.GKE_ZONE }}
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.GKE_ZONE }}
SERVICE_NAMES=$(cat projects-changes-deploy.txt)
echo "Service Names: $SERVICE_NAMES"
for SERVICE_NAME in $(echo $SERVICE_NAMES | tr ',' ' '); do
Expand Down Expand Up @@ -160,8 +161,6 @@ jobs:
cd ..
fi
done
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# Sonar Analysis for Angular projects
- name: Sonar Analysis for Angular projects
Expand All @@ -181,5 +180,3 @@ jobs:
cd ..
fi
done
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 comments on commit 433f2ed

Please sign in to comment.