From 95e818a73b39e00038a3dd25d9f4a83d7f102bf6 Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Thu, 30 May 2024 12:44:05 +0100 Subject: [PATCH 1/2] ci: tear down docs infra after PR is merged --- .github/workflows/docs-destroy.yml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/docs-destroy.yml diff --git a/.github/workflows/docs-destroy.yml b/.github/workflows/docs-destroy.yml new file mode 100644 index 0000000000000..861a6319fe95d --- /dev/null +++ b/.github/workflows/docs-destroy.yml @@ -0,0 +1,32 @@ +name: Docs destroy +on: + pull_request_target: + types: [closed] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Destroy Docs Subdomain + env: + TF_VAR_prefix_name: "pr-${{ github.event.number }}" + TF_VAR_prefix_event_type: "pr" + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + TF_STATE_POSTGRES_CONN_STR: ${{ secrets.TF_STATE_POSTGRES_CONN_STR }} + uses: gruntwork-io/terragrunt-action@v2 + with: + tg_version: "0.58.12" + tofu_version: "1.7.1" + tg_dir: "deployment/modules/cloudflare/docs" + tg_command: "destroy" + + - name: Comment + uses: actions-cool/maintain-one-comment@v3 + with: + number: ${{ github.event.number }} + delete: true + body-include: '' From 730fc9efc433cb83b004fa3ab2c20712a9aa919e Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Thu, 30 May 2024 13:19:58 +0100 Subject: [PATCH 2/2] ci: release flow for docs deployments fixes --- deployment/modules/cloudflare/docs-release/domain.tf | 8 +++++++- deployment/modules/cloudflare/docs/domain.tf | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/deployment/modules/cloudflare/docs-release/domain.tf b/deployment/modules/cloudflare/docs-release/domain.tf index 1221ea595adf1..a8e93b8dd5c6b 100644 --- a/deployment/modules/cloudflare/docs-release/domain.tf +++ b/deployment/modules/cloudflare/docs-release/domain.tf @@ -1,8 +1,14 @@ +resource "cloudflare_pages_domain" "immich_app_release_domain" { + account_id = var.cloudflare_account_id + project_name = data.terraform_remote_state.cloudflare_account.outputs.immich_app_archive_pages_project_name + domain = "immich.app" +} + resource "cloudflare_record" "immich_app_release_domain" { name = "immich.app" proxied = true ttl = 1 type = "CNAME" - value = data.terraform_remote_state.cloudflare_immich_app_docs.outputs.immich_app_branch_subdomain + value = data.terraform_remote_state.cloudflare_immich_app_docs.outputs.immich_app_branch_pages_hostname zone_id = data.terraform_remote_state.cloudflare_account.outputs.immich_app_zone_id } diff --git a/deployment/modules/cloudflare/docs/domain.tf b/deployment/modules/cloudflare/docs/domain.tf index d662c37d87337..6d00f26b604c6 100644 --- a/deployment/modules/cloudflare/docs/domain.tf +++ b/deployment/modules/cloudflare/docs/domain.tf @@ -17,6 +17,10 @@ output "immich_app_branch_subdomain" { value = cloudflare_record.immich_app_branch_subdomain.hostname } +output "immich_app_branch_pages_hostname" { + value = cloudflare_record.immich_app_branch_subdomain.value +} + output "pages_project_name" { value = cloudflare_pages_domain.immich_app_branch_domain.project_name }