Skip to content

Commit 2506231

Browse files
authored
Merge pull request #42 from dddsw/2026
Deployment fixes
2 parents bb6ab17 + d3976ca commit 2506231

9 files changed

Lines changed: 32 additions & 22 deletions

File tree

.github/workflows/DeployBlazorClient.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
environment: dev
1010
name: Build and Deploy Job
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
with:
1414
submodules: true
1515
- name: Build And Deploy

.github/workflows/DeployBranchPush.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ jobs:
1010
uses: ./.github/workflows/DeployEverything.yml
1111
with:
1212
env: "dev"
13-
secrets:
13+
secrets:
14+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
1415
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
1516
AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
1617
TERRAFORM_STATE_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}

.github/workflows/DeployEverything.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
default: "Test"
88
type: string
99
secrets:
10+
AZURE_SUBSCRIPTION_ID:
11+
required: true
1012
AZURE_CREDENTIALS:
1113
required: true
1214
AZURE_STATIC_WEB_APPS_API_TOKEN:
@@ -21,9 +23,13 @@ on:
2123
env:
2224
AZURE_WEBAPP_PACKAGE_PATH: PocketDDD.Server.WebAPI/publish
2325
CONFIGURATION: Release
24-
DOTNET_CORE_VERSION: 8.0.x
26+
DOTNET_CORE_VERSION: 10.0.x
2527
WORKING_DIRECTORY: PocketDDD.Server/PocketDDD.Server.WebAPI
2628

29+
permissions:
30+
contents: read
31+
id-token: write
32+
2733
jobs:
2834
deploy_terraform:
2935
runs-on: ubuntu-latest
@@ -36,16 +42,17 @@ jobs:
3642
steps:
3743
- uses: actions/checkout@v4
3844
- name: Log in with Azure
39-
uses: azure/login@v1
45+
uses: azure/login@v2
4046
with:
4147
creds: '${{ secrets.AZURE_CREDENTIALS }}'
4248
- name: Setup terraform
43-
uses: hashicorp/setup-terraform@v3
49+
uses: hashicorp/setup-terraform@v4
4450
- run: |
4551
terraform init -backend-config="key=${{ inputs.env }}.terraform.tfstate"
4652
4753
terraform apply -auto-approve -var-file ../tfvars/${{ inputs.env }}.tfvars -var 'cloudflare_account_id=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}'
4854
env:
55+
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
4956
ARM_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
5057
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
5158
@@ -79,7 +86,7 @@ jobs:
7986
needs: [deploy_terraform, build_api_server]
8087
steps:
8188
- name: Log in with Azure
82-
uses: azure/login@v1
89+
uses: azure/login@v2
8390
with:
8491
creds: '${{ secrets.AZURE_CREDENTIALS }}'
8592
- name: Download artifact from build job
@@ -88,7 +95,7 @@ jobs:
8895
name: webapp
8996
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
9097
- name: Deploy to Azure WebApp
91-
uses: azure/webapps-deploy@v2
98+
uses: azure/webapps-deploy@v3
9299
with:
93100
app-name: pocketddd-${{ inputs.env }}-api-server-web-app
94101
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
@@ -99,11 +106,11 @@ jobs:
99106
name: Build and Deploy Blazor Client
100107
needs: deploy_terraform
101108
steps:
102-
- uses: actions/checkout@v2
109+
- uses: actions/checkout@v4
103110
with:
104111
submodules: true
105112
- name: Log in with Azure
106-
uses: azure/login@v1
113+
uses: azure/login@v2
107114
with:
108115
creds: '${{ secrets.AZURE_CREDENTIALS }}'
109116

.github/workflows/DeployMainBranch.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
uses: ./.github/workflows/DeployEverything.yml
1212
with:
1313
env: "Production"
14-
secrets:
14+
secrets:
15+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
1516
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
1617
AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
1718
TERRAFORM_STATE_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}

.github/workflows/DeployServerWebAPI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
- name: Setup .NET SDK
17-
uses: actions/setup-dotnet@v3
17+
uses: actions/setup-dotnet@v4
1818
with:
1919
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
2020
- name: Restore
@@ -37,7 +37,7 @@ jobs:
3737
needs: build
3838
steps:
3939
- name: Log in with Azure
40-
uses: azure/login@v1
40+
uses: azure/login@v2
4141
with:
4242
creds: '${{ secrets.AZURE_CREDENTIALS }}'
4343
- name: Download artifact from build job
@@ -46,7 +46,7 @@ jobs:
4646
name: webapp
4747
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
4848
- name: Deploy to Azure WebApp
49-
uses: azure/webapps-deploy@v2
49+
uses: azure/webapps-deploy@v3
5050
with:
5151
app-name: pocketddd-dev-api-server
5252
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

terraform/api_server.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ resource "azurerm_linux_web_app" "api_server_web_app" {
1515

1616
site_config {
1717
application_stack {
18-
dotnet_version = "8.0"
18+
dotnet_version = "10.0"
1919
}
2020
always_on = var.api_always_on
2121
}

terraform/blazor_client.tf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ resource "azurerm_key_vault_secret" "blazor_client_deployment_token" {
2121
}
2222

2323
data "cloudflare_zone" "dns_zone" {
24-
account_id = var.cloudflare_account_id
25-
name = "dddsouthwest.com"
24+
zone_id = "4c52c7e174b32da4b4786d3dba3d955f"
2625
}
2726

28-
resource "cloudflare_record" "cname_record" {
27+
resource "cloudflare_dns_record" "cname_record" {
2928
zone_id = data.cloudflare_zone.dns_zone.id
3029
name = local.subdomain
3130
content = azurerm_static_web_app.blazor-client.default_host_name
@@ -35,6 +34,6 @@ resource "cloudflare_record" "cname_record" {
3534

3635
resource "azurerm_static_web_app_custom_domain" "custom_domain" {
3736
static_web_app_id = azurerm_static_web_app.blazor-client.id
38-
domain_name = cloudflare_record.cname_record.hostname
37+
domain_name = cloudflare_dns_record.cname_record.name
3938
validation_type = "cname-delegation"
4039
}

terraform/terraform.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
terraform {
2+
required_version = ">= 1.10.0"
3+
24
backend "azurerm" {
35
resource_group_name = "pocketddd-terraform-state"
46
storage_account_name = "pocketdddterraformstate"
@@ -7,15 +9,15 @@ terraform {
79
required_providers {
810
azurerm = {
911
source = "hashicorp/azurerm"
10-
version = "3.100.0"
12+
version = "~> 4.10.0"
1113
}
1214
random = {
1315
source = "hashicorp/random"
14-
version = "3.6.1"
16+
version = "~> 3.7.0"
1517
}
1618
cloudflare = {
1719
source = "cloudflare/cloudflare"
18-
version = "~> 4.0"
20+
version = "~> 5.0"
1921
}
2022
}
2123
}

tfvars/dev.tfvars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
env = "dev"
22
sql_db_sku = "Basic"
33
sql_max_storage = "2"
4-
api_app_service_sku = "F1"
4+
api_app_service_sku = "B1"
55
api_always_on = false
66
client_sku_tier = "Free"
77
client_sku_size = "Free"

0 commit comments

Comments
 (0)