Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FD-1831] Update deployments to use env SERVICE #162

Merged
merged 5 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 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,18 @@ 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 }}"
image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
env_vars: VERSION=${VERSION}
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
12 changes: 7 additions & 5 deletions .github/workflows/deploy_qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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 @@ -24,6 +24,8 @@ jobs:
deploy:
runs-on: 'ubuntu-latest'

if: github.event.pull_request.base.ref == 'release'

environment:
name: uat

Expand Down Expand Up @@ -61,18 +63,18 @@ 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 }}"
image: "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
env_vars: VERSION=${VERSION}
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build-uat": "vite build --mode uat",
"build-alpha": "vite build --mode alpha",
"build-prod": "vite build --mode prod",
"build-kf": "vite build --mode kf",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down
Loading