Skip to content

Commit

Permalink
VAST-260 changed the resources
Browse files Browse the repository at this point in the history
  • Loading branch information
swisstxtsokol committed Oct 29, 2024
1 parent 8464bf3 commit 148a1b6
Show file tree
Hide file tree
Showing 6 changed files with 529 additions and 48 deletions.
50 changes: 40 additions & 10 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,51 @@
name: Deploy to Google Cloud Run
name: Deploy to Google Cloud

on:
push:
branches:
- main
- dev
- develop
workflow_dispatch:

env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
REGION: ${{ secrets.REGION }}
REPOSITORY_NAME: "keycloak-repo" # Must be local.registry_name
IMAGE_NAME: "keycloak-image" # @todo is it right?
IMAGE_TAG: "latest" # default??

jobs:
terraform:
name: Apply Terraform Configuration
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

deploy:
name: Deploy to Google Cloud Run
needs: terraform
runs-on: ubuntu-latest
- name: Set up Google Cloud credentials
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}

steps:
- name: Configure Docker
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev

- name: Build Docker image
run: |
# "europe-west6-docker.pkg.dev/keycloak-dev-399613/keycloak/keycloak@sha256:0eeed2228ff032040510f2b478f1bb475693179018cfd5587d9a0cc1d7c5716e"
docker build -t ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} .

- name: Push Docker image to Google Artifact Registry
run: |
docker push ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_wrapper: false

- name: Terraform Init
run: terraform init

- name: Terraform Apply
run: |
terraform apply -auto-approve -var="project_id=${{ env.PROJECT_ID }}" -var="region=${{ env.REGION }}" -var="image=${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}"
21 changes: 21 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .terraform/environment
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev
Loading

0 comments on commit 148a1b6

Please sign in to comment.