Skip to content
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
22 changes: 14 additions & 8 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
type: string
required: true
description: The artifact registry repository name.
artifact_registry_location:
region:
type: string
required: true
description: The artifact registry region name.
Expand All @@ -38,6 +38,10 @@ on:
type: string
required: true
description: The directory where the source code lives.
cloud_run_sa:
type: string
required: false
description: The directory where the source code lives.

jobs:
cloud-run:
Expand All @@ -51,6 +55,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3


- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v0'
Expand All @@ -66,29 +71,30 @@ jobs:
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ inputs.artifact_registry_location }}-docker.pkg.dev'
registry: '${{ inputs.region }}-docker.pkg.dev'

- name: Build and Tag
id: build-image
uses: docker/build-push-action@v3
with:
context: ${{ inputs.code_directory }}
push: true
tags: ${{ inputs.artifact_registry_location }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }}
tags: ${{ inputs.region }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }}

- name: Docker Push
run: |-
docker push "${{ inputs.artifact_registry_location }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }}"
docker push "${{ inputs.region }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }}"

- name: Create Service declaration
run: |-
export CONTAINER_IMAGE="${{ inputs.artifact_registry_location }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }}"
export CONTAINER_IMAGE="${{ inputs.region }}-docker.pkg.dev/${{ inputs.gcp_project_id }}/${{ inputs.artifact_registry_repo }}/${{ inputs.service_name }}:${{ inputs.ref }}"
export SERVICE_NAME="${{ inputs.service_name }}"
export PROJECT_ID="${{ inputs.gcp_project_id }}"
export REVISION_TAG=${{ inputs.ref }}
export CLOUD_RUN_SA=${{ inputs.cloud_run_sa }}
export REVISION_TAG="${{ inputs.ref }}"
export CLOUD_RUN_SA="${{ inputs.cloud_run_sa }}"
export DATABASE="${{ secrets.database }}"
envsubst < ./service-yaml/container.yaml > container.yaml

- name: Deploy to Cloud Run
run: |-
gcloud run services replace container.yaml --region=${{ inputs.artifact_registry_location }}
gcloud run services replace container.yaml --region=${{ inputs.region }}
21 changes: 6 additions & 15 deletions .github/workflows/env_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

#DEV
dev:
if: startsWith(github.ref_name, 'develop')
if: startsWith(github.ref_name, 'feature')
uses: ./.github/workflows/deployment.yaml
permissions:
id-token: write
Expand All @@ -23,10 +23,11 @@ jobs:
ref: ${{ github.sha }}
gcp_project_id: arched-inkwell-368821
artifact_registry_repo: reference-architectures
artifact_registry_location: us-east4
region: us-east4
docker_image_name: pods
service_name: pods
code_directory: ./code/Samples.Run.MarkdownPreview.Editor
cloud_run_sa: cloud-run-sa
secrets: inherit

#QA
Expand All @@ -41,7 +42,7 @@ jobs:
ref: ${{ github.sha }}
gcp_project_id: arched-inkwell-368821
artifact_registry_repo: reference-architectures
artifact_registry_location: us-east4
region: us-east4
docker_image_name: pods
service_name: pods
code_directory: ./code/Samples.Run.MarkdownPreview.Editor
Expand All @@ -59,18 +60,8 @@ jobs:
ref: ${{ github.sha }}
gcp_project_id: arched-inkwell-368821
artifact_registry_repo: reference-architectures
artifact_registry_location: us-east4
region: us-east4
docker_image_name: pods
service_name: pods
code_directory: ./code/Samples.Run.MarkdownPreview.Editor
secrets: inherit

# env:
# PROJECT_ID: arched-inkwell-368821 # TODO: update Google Cloud project id
# GAR_LOCATION: us-east4 # TODO: update Artifact Registry location
# REPOSITORY: reference-architectures # TODO: update Artifact Registry repository name
# CONTAINER_SERVICE: pods # TODO: update Cloud Run service name
# REGION: us-east4 # TODO: update Cloud Run service region #
# IMAGE_TAG: latest
# WORKING_DIRECTORY: ./terraform
# CLOUD_RUN_SA: cloud-run-sa
secrets: inherit
Loading