Skip to content

Commit

Permalink
updated deploy.yml to include secrets for env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
naumanzchaudhry committed Oct 5, 2024
1 parent 84d6acc commit 15cb1c6
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,27 @@ jobs:
- name: Activate Service Account
run: gcloud auth activate-service-account --key-file=/home/runner/work/_temp/gcp-key.json

- name: Deploy API to GCP
- name: Prepare Env Variables based on environment
run: |
if [[ "${{ github.event.inputs.environment }}" == "uat" ]]; then
gcloud run deploy tasker-api-uat --image docker.io/naumanz/tasker-api:uat --region us-central1 --allow-unauthenticated
ENVIRONMENT=uat
HTTP_PORT=${{ secrets.HTTP_PORT }}
DATABASE_URL=${{ secrets.UAT_DB_URL }}
JWT_SECRET=${{ secrets.JWT_SECRET }}
elif [[ "${{ github.event.inputs.environment }}" == "prod" ]]; then
gcloud run deploy tasker-api-prod --image docker.io/naumanz/tasker-api:prod --region us-central1 --allow-unauthenticated
ENVIRONMENT=prod
HTTP_PORT=${{ secrets.HTTP_PORT }}
DATABASE_URL=${{ secrets.UAT_DB_URL }}
JWT_SECRET=${{ secrets.JWT_SECRET }}
fi
- name: Deploy API to GCP (${{ github.event.inputs.environment }})
run: |
gcloud run deploy tasker-api-$ENVIRONMENT \
--image docker.io/naumanz/tasker-api:$ENVIRONMENT \
--region us-central1 \
--allow-unauthenticated \
--set-env-vars HTTP_PORT=$HTTP_PORT \
--set-env-vars DATABASE_URL=$DATABASE_URL \
--set-env-vars JWT_SECRET=$JWT_SECRET

0 comments on commit 15cb1c6

Please sign in to comment.