Skip to content

Commit

Permalink
build: Add Analytics Base Url to CD and terraform (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
egekocabas authored Dec 12, 2023
1 parent 680ddc9 commit 105e07c
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defaults:
env:
TF_VAR_GITHUB_TOKEN: ${{ secrets.MINING_GITHUB_TOKEN }}
TF_VAR_FIREBASE_ADMINSDK_CERTIFICATE: ${{ github.event_name == 'release' && secrets.PROD_FIREBASE_ADMINSDK_CERTIFICATE || secrets.STAGING_FIREBASE_ADMINSDK_CERTIFICATE}}
TF_VAR_ANALYTICS_BASE_URL: ${{ github.event_name == 'release' && vars.PROD_ANALYTICS_BASE_URL || vars.STAGING_ANALYTICS_BASE_URL}}

jobs:
deploy:
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ COPY --chown=$MAMBA_USER:$MAMBA_USER parma_mining /app/parma_mining

ENV GITHUB_TOKEN=$GITHUB_TOKEN
ENV "FIREBASE_ADMINSDK_CERTIFICATE"=$FIREBASE_ADMINSDK_CERTIFICATE
ENV ANALYTICS_BASE_URL=$ANALYTICS_BASE_URL


EXPOSE 8080

Expand Down
4 changes: 4 additions & 0 deletions terraform/module/service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ resource "google_cloud_run_service" "parma_mining_github_cloud_run" {
name = "FIREBASE_ADMINSDK_CERTIFICATE"
value = var.FIREBASE_ADMINSDK_CERTIFICATE
}
env {
name = "ANALYTICS_BASE_URL"
value = var.ANALYTICS_BASE_URL
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions terraform/module/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ variable "FIREBASE_ADMINSDK_CERTIFICATE" {
type = string
sensitive = true
}

variable "ANALYTICS_BASE_URL" {
description = "value"
type = string
}
11 changes: 6 additions & 5 deletions terraform/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ provider "google" {
}

module "main" {
source = "../module"
env = "prod"
project = local.project
region = local.region
GITHUB_TOKEN = var.GITHUB_TOKEN
source = "../module"
env = "prod"
project = local.project
region = local.region
GITHUB_TOKEN = var.GITHUB_TOKEN
FIREBASE_ADMINSDK_CERTIFICATE = var.FIREBASE_ADMINSDK_CERTIFICATE
ANALYTICS_BASE_URL = var.ANALYTICS_BASE_URL
}
5 changes: 5 additions & 0 deletions terraform/prod/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ variable "FIREBASE_ADMINSDK_CERTIFICATE" {
type = string
sensitive = true
}

variable "ANALYTICS_BASE_URL" {
description = "value"
type = string
}
11 changes: 6 additions & 5 deletions terraform/staging/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ provider "google" {
}

module "main" {
source = "../module"
env = "staging"
project = local.project
region = local.region
GITHUB_TOKEN = var.GITHUB_TOKEN
source = "../module"
env = "staging"
project = local.project
region = local.region
GITHUB_TOKEN = var.GITHUB_TOKEN
FIREBASE_ADMINSDK_CERTIFICATE = var.FIREBASE_ADMINSDK_CERTIFICATE
ANALYTICS_BASE_URL = var.ANALYTICS_BASE_URL
}
5 changes: 5 additions & 0 deletions terraform/staging/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ variable "FIREBASE_ADMINSDK_CERTIFICATE" {
type = string
sensitive = true
}

variable "ANALYTICS_BASE_URL" {
description = "value"
type = string
}

0 comments on commit 105e07c

Please sign in to comment.