Skip to content

Commit

Permalink
[FD-1831] Update deployments to use env SERVICE
Browse files Browse the repository at this point in the history
  • Loading branch information
brendagutman committed Dec 27, 2024
1 parent 52e7515 commit 4288769
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

PROJECT_ID: ${{ secrets.PROJECT_ID }}
REGION: ${{ secrets.REGION_LOC_1 }}
SERVICE: 'mapdragon'
SERVICE: ${{ secrets.SERVICE }}
IMAGE_NAME: 'map-dragon_img'
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}

Expand Down Expand Up @@ -62,18 +62,17 @@ jobs:
- name: 'Build Docker Image' # New step to build the image

run: |-
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-dev/${{ env.IMAGE_NAME }}:${{ github.sha }}"
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
docker build -t "${DOCKER_TAG}" --build-arg ENV=dev .
- name: 'Push Docker Image'
run: |-
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-dev/${{ env.IMAGE_NAME }}:${{ github.sha }}"
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
docker push "${DOCKER_TAG}"
- name: 'Deploy to Cloud Run'
uses: 'google-github-actions/deploy-cloudrun@v2'
with:
service: '${{ env.SERVICE }}-dev'
service: '${{ env.SERVICE }}'
region: '${{ env.REGION }}'
image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-dev/${{ env.IMAGE_NAME }}:${{ github.sha }}"
env_vars: VERSION=${VERSION}
image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
2 changes: 1 addition & 1 deletion .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

PROJECT_ID: ${{ secrets.PROJECT_ID }}
REGION: ${{ secrets.REGION_LOC_1 }}
SERVICE: 'mapdragon'
SERVICE: ${{ secrets.SERVICE }}
IMAGE_NAME: 'map-dragon_img'
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}

Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/deploy_qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ env:

PROJECT_ID: ${{ secrets.PROJECT_ID }}
REGION: ${{ secrets.REGION_LOC_1 }}
<<<<<<< Updated upstream
SERVICE: 'mapdragon'
=======
SERVICE: ${{ secrets.SERVICE }}
>>>>>>> Stashed changes
IMAGE_NAME: 'map-dragon_img'
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}

Expand Down Expand Up @@ -61,18 +65,17 @@ jobs:
- name: 'Build Docker Image' # New step to build the image
run: |-
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-uat/${{ env.IMAGE_NAME }}:${{ github.sha }}"
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
docker build -t "${DOCKER_TAG}" --build-arg ENV=uat .
- name: 'Push Docker Image'
run: |-
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-uat/${{ env.IMAGE_NAME }}:${{ github.sha }}"
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
docker push "${DOCKER_TAG}"
- name: 'Deploy to Cloud Run'
uses: 'google-github-actions/deploy-cloudrun@v2'
with:
service: '${{ env.SERVICE }}-uat'
service: '${{ env.SERVICE }}'
region: '${{ env.REGION }}'
image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}-uat/${{ env.IMAGE_NAME }}:${{ github.sha }}"
env_vars: VERSION=${VERSION}
image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
15 changes: 6 additions & 9 deletions .github/workflows/dispatch_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment (e.g., dev, uat, prod, alpha)'
description: 'Deployment environment (e.g., dev, uat, prod, alpha, kf)'
required: true
type: string
default: 'dev'
Expand All @@ -26,7 +26,7 @@ env:

PROJECT_ID: ${{ secrets.PROJECT_ID }}
REGION: ${{ secrets.REGION_LOC_1 }}
SERVICE: 'mapdragon'
SERVICE: ${{ secrets.SERVICE }}
IMAGE_NAME: 'map-dragon_img'
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}

Expand All @@ -48,6 +48,9 @@ jobs:
uses: 'actions/checkout@v4'
with:
ref: ${{ github.event.inputs.deploy_branch }} # This branch is deployed

- name: "Deploying ${{ github.event.inputs.deploy_branch }} to ${{ github.event.inputs.environment }}"
run: echo "Deploying ${{ github.event.inputs.deploy_branch }} to ${{ github.event.inputs.environment }}"

- id: 'auth'
name: 'Authenticate to Google Cloud'
Expand All @@ -67,15 +70,9 @@ jobs:
- name: 'Build Docker Image'
run: |-
if [[ "${{ github.event.inputs.environment }}" == "prod" ]]; then
SERVICE="${{ env.SERVICE }}"
else
SERVICE="${{ env.SERVICE }}-${{ github.event.inputs.environment }}"
fi
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${SERVICE}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
echo "SERVICE=${SERVICE}" >> $GITHUB_ENV
docker build -t "${DOCKER_TAG}" --build-arg ENV=${{ github.event.inputs.environment }} .
Expand Down

0 comments on commit 4288769

Please sign in to comment.