Skip to content

Commit

Permalink
deploy workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
witoldnowogorski committed Mar 24, 2024
1 parent 1c735ef commit 21b9fc9
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 80 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Deployment

on:
push:
branches:
- prod

jobs:
deploy:
steps:
File renamed without changes.
158 changes: 79 additions & 79 deletions src/infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,84 +14,84 @@ provider "google" {
}

# Enable IAM API
resource "google_project_service" "iam" {
provider = google
service = "iam.googleapis.com"
disable_on_destroy = false
}

# Enable Artifact Registry API
resource "google_project_service" "artifactregistry" {
provider = google
service = "artifactregistry.googleapis.com"
disable_on_destroy = false
}

#############################################
# Enable API's #
#############################################

# Enable Cloud Run API
resource "google_project_service" "cloudrun" {
provider = google
service = "run.googleapis.com"
disable_on_destroy = false
}

# Enable Cloud Resource Manager API
resource "google_project_service" "resourcemanager" {
provider = google
service = "cloudresourcemanager.googleapis.com"
disable_on_destroy = false
}

resource "time_sleep" "wait_30_seconds" {
create_duration = "30s"
depends_on = [
google_project_service.iam,
google_project_service.artifactregistry,
google_project_service.cloudrun,
google_project_service.resourcemanager
]
}

#############################################
# Google Artifact Registry Repository #
#############################################

# Create Artifact Registry Repository for Docker containers
resource "google_artifact_registry_repository" "my_docker_repo" {
provider = google

location = var.region
repository_id = var.repository
description = "My docker repository"
format = "DOCKER"
depends_on = [time_sleep.wait_30_seconds]
}

# Create a service account
resource "google_service_account" "docker_pusher" {
provider = google

account_id = "docker-pusher"
display_name = "Docker Container Pusher"
depends_on =[time_sleep.wait_30_seconds]
}

# Give service account permission to push to the Artifact Registry Repository
resource "google_artifact_registry_repository_iam_member" "docker_pusher_iam" {
provider = google

location = google_artifact_registry_repository.my_docker_repo.location
repository = google_artifact_registry_repository.my_docker_repo.repository_id
role = "roles/artifactregistry.writer"
member = "serviceAccount:${google_service_account.docker_pusher.email}"
depends_on = [
google_artifact_registry_repository.my_docker_repo,
google_service_account.docker_pusher
]
}
#resource "google_project_service" "iam" {
# provider = google
# service = "iam.googleapis.com"
# disable_on_destroy = false
#}
#
## Enable Artifact Registry API
#resource "google_project_service" "artifactregistry" {
# provider = google
# service = "artifactregistry.googleapis.com"
# disable_on_destroy = false
#}
#
##############################################
## Enable API's #
##############################################
#
## Enable Cloud Run API
#resource "google_project_service" "cloudrun" {
# provider = google
# service = "run.googleapis.com"
# disable_on_destroy = false
#}
#
## Enable Cloud Resource Manager API
#resource "google_project_service" "resourcemanager" {
# provider = google
# service = "cloudresourcemanager.googleapis.com"
# disable_on_destroy = false
#}
#
#resource "time_sleep" "wait_30_seconds" {
# create_duration = "30s"
# depends_on = [
# google_project_service.iam,
# google_project_service.artifactregistry,
# google_project_service.cloudrun,
# google_project_service.resourcemanager
# ]
#}
#
##############################################
## Google Artifact Registry Repository #
##############################################
#
## Create Artifact Registry Repository for Docker containers
#resource "google_artifact_registry_repository" "my_docker_repo" {
# provider = google
#
# location = var.region
# repository_id = var.repository
# description = "My docker repository"
# format = "DOCKER"
# depends_on = [time_sleep.wait_30_seconds]
#}
#
## Create a service account
#resource "google_service_account" "docker_pusher" {
# provider = google
#
# account_id = "docker-pusher"
# display_name = "Docker Container Pusher"
# depends_on =[time_sleep.wait_30_seconds]
#}
#
## Give service account permission to push to the Artifact Registry Repository
#resource "google_artifact_registry_repository_iam_member" "docker_pusher_iam" {
# provider = google
#
# location = google_artifact_registry_repository.my_docker_repo.location
# repository = google_artifact_registry_repository.my_docker_repo.repository_id
# role = "roles/artifactregistry.writer"
# member = "serviceAccount:${google_service_account.docker_pusher.email}"
# depends_on = [
# google_artifact_registry_repository.my_docker_repo,
# google_service_account.docker_pusher
# ]
#}


##############################################
Expand Down Expand Up @@ -126,7 +126,7 @@ resource "google_cloud_run_service" "api_test" {
percent = 100
latest_revision = true
}
depends_on = [google_artifact_registry_repository_iam_member.docker_pusher_iam]
# depends_on = [google_artifact_registry_repository_iam_member.docker_pusher_iam]
}

# Create a policy that allows all users to invoke the API
Expand Down
2 changes: 1 addition & 1 deletion src/sources/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}
],
"html": [
sss "https://iet.agh.edu.pl/olimpiada-wiedzy-elektrycznej-i-elektronicznej/",
"https://iet.agh.edu.pl/olimpiada-wiedzy-elektrycznej-i-elektronicznej/",
"https://www.eaiib.agh.edu.pl/european-rover-challenge-2022/agh-space-systems-relacja-z-usa/",
"https://www.eaiib.agh.edu.pl/kolejny-sukces-dr-inz-marka-wodzinskiego-pracownika-naszego-wydzialu/",
"https://www.eaiib.agh.edu.pl/nowoczesne-kierunki-studiow-agh/",
Expand Down

0 comments on commit 21b9fc9

Please sign in to comment.