From 447499e1ceb5cb05a98e3f3b2e5762c27529e5a3 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Wed, 14 Jan 2026 11:31:49 +0100 Subject: [PATCH 01/21] step1 --- .github/workflows/deploy-infra-and-apps.yml | 35 +++++++++++++++++++++ Infrastructure/main.bicep | 32 +++++++++++++++++++ Infrastructure/modules/appService.bicep | 22 +++++++++++++ Infrastructure/modules/appServicePlan.bicep | 20 ++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 .github/workflows/deploy-infra-and-apps.yml create mode 100644 Infrastructure/main.bicep create mode 100644 Infrastructure/modules/appService.bicep create mode 100644 Infrastructure/modules/appServicePlan.bicep diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml new file mode 100644 index 00000000..7b6de93d --- /dev/null +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -0,0 +1,35 @@ +on: [push, workflow_dispatch] + +env: + AZURE_RG_NAME: rg-${{ vars.PROJECT_NAME }}-${{ vars.AZURE_RESOURCE_IDENTIFIER }} + +jobs: + deploy_infrastructure: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + enable-AzPSSession: true + + - name: Create resource group if not exists + run: | + az group show --name ${{ env.AZURE_RG_NAME }} || + az group create --name ${{ env.AZURE_RG_NAME }} --location ${{ secrets.AZURE_REGION }} + + - name: Deploy bicep + id: bicep_deploy + uses: azure/arm-deploy@v2 + with: + subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} + region: ${{ secrets.AZURE_REGION }} + template: ./infrastructure/main.bicep + parameters: project=${{ vars.PROJECT_NAME }} location=${{ secrets.AZURE_REGION }} identifier=${{ vars.AZURE_RESOURCE_IDENTIFIER }} + resourceGroupName: ${{ env.AZURE_RG_NAME }} \ No newline at end of file diff --git a/Infrastructure/main.bicep b/Infrastructure/main.bicep new file mode 100644 index 00000000..22252465 --- /dev/null +++ b/Infrastructure/main.bicep @@ -0,0 +1,32 @@ +targetScope = 'resourceGroup' // We'll deploy the resources in the provided resource group + +// Parameters to easily construct resource names +param location string +param project string + +// Here we'll add an identifier to create a unique name for the App Service Plan, for example your trigram, so that everyone could deploy his own parkndeploy instance +param identifier string + +// Create the AppServicePlan through the AppServicePlan module +module appServicePlan 'modules/appServicePlan.bicep' = { + name: 'appServicePlan' + params: { + location: location + project: project + identifier: identifier + } +} + +// Create the AppService through the AppService module +module appService 'modules/appService.bicep' = { + name: 'appService' + params: { + location: location + project: project + identifier: identifier + planId: appServicePlan.outputs.planId // Use the appServicePlan output to get its id back => an App Service needs to reference its App Service Plan + } +} + +// Export App Service Name +output appServiceName string = appService.outputs.appServiceName \ No newline at end of file diff --git a/Infrastructure/modules/appService.bicep b/Infrastructure/modules/appService.bicep new file mode 100644 index 00000000..740e0841 --- /dev/null +++ b/Infrastructure/modules/appService.bicep @@ -0,0 +1,22 @@ +param location string +param project string +param identifier string + +// App Service Plan identifier that will host our App Service +param planId string + +resource app 'Microsoft.Web/sites@2022-03-01' = { + name: '${project}-app-${identifier}' + location: location + + properties: { + serverFarmId: planId + reserved: true + + siteConfig: { + linuxFxVersion: 'DOTNETCORE|9.0' // Specify to setup the .NET Core 9.0 runtime (used by our backend API) on the Linux machine under the hood + } + } +} + +output appServiceName string = app.name // Export the App Service name for deployment \ No newline at end of file diff --git a/Infrastructure/modules/appServicePlan.bicep b/Infrastructure/modules/appServicePlan.bicep new file mode 100644 index 00000000..c871995f --- /dev/null +++ b/Infrastructure/modules/appServicePlan.bicep @@ -0,0 +1,20 @@ +param location string +param project string +param identifier string + +resource plan 'Microsoft.Web/serverfarms@2022-09-01' = { + name: '${project}-plan-${identifier}' + location: location + + sku: { + name: 'F1' // We use F1 pricing plan (free one) as we don't need specific features + } + + kind: 'app,linux' // Allow to deploy on an App Service using Linux OS + + properties: { + reserved: true // Specifity of App Service with Linux OS + } +} + +output planId string = plan.id // Export the App Service identifier \ No newline at end of file From fd17185c6b6e77f330d3c7d46c62a0fe22c5654f Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 14:15:52 +0100 Subject: [PATCH 02/21] commit1mardi --- .github/workflows/deploy-infra-and-apps.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml index 7b6de93d..00c301ff 100644 --- a/.github/workflows/deploy-infra-and-apps.yml +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -1,4 +1,8 @@ on: [push, workflow_dispatch] + +permissions: + id-token: write + env: AZURE_RG_NAME: rg-${{ vars.PROJECT_NAME }}-${{ vars.AZURE_RESOURCE_IDENTIFIER }} @@ -6,6 +10,7 @@ env: jobs: deploy_infrastructure: runs-on: ubuntu-latest + environment: production steps: - name: Checkout repository @@ -32,4 +37,6 @@ jobs: region: ${{ secrets.AZURE_REGION }} template: ./infrastructure/main.bicep parameters: project=${{ vars.PROJECT_NAME }} location=${{ secrets.AZURE_REGION }} identifier=${{ vars.AZURE_RESOURCE_IDENTIFIER }} - resourceGroupName: ${{ env.AZURE_RG_NAME }} \ No newline at end of file + resourceGroupName: ${{ env.AZURE_RG_NAME }} + + From 997db696f25b16e61976756a876ec90e3ca5bc69 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 14:41:55 +0100 Subject: [PATCH 03/21] jfjg --- .github/workflows/deploy-infra-and-apps.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml index 00c301ff..bc8a5d6f 100644 --- a/.github/workflows/deploy-infra-and-apps.yml +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -3,7 +3,6 @@ on: [push, workflow_dispatch] permissions: id-token: write - env: AZURE_RG_NAME: rg-${{ vars.PROJECT_NAME }}-${{ vars.AZURE_RESOURCE_IDENTIFIER }} From eb924bd277c3e12ad2fb6db9b7ee2aa1f6dfcc41 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 14:49:51 +0100 Subject: [PATCH 04/21] test --- .vscode/launch.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..2ba986f6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file From 83acb45c10e145ee73f0a1f2d9b482cf1bd32190 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 14:53:39 +0100 Subject: [PATCH 05/21] step1 --- Infrastructure/main.bicep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Infrastructure/main.bicep b/Infrastructure/main.bicep index 22252465..733958d1 100644 --- a/Infrastructure/main.bicep +++ b/Infrastructure/main.bicep @@ -1,4 +1,4 @@ -targetScope = 'resourceGroup' // We'll deploy the resources in the provided resource group +targetScope = 'resourceGroup' // We'll deploy the resources in the provided resource g // Parameters to easily construct resource names param location string @@ -29,4 +29,4 @@ module appService 'modules/appService.bicep' = { } // Export App Service Name -output appServiceName string = appService.outputs.appServiceName \ No newline at end of file +output appServiceName string = appService.outputs.appServiceName From 7ff52d13812b27959c73c8cee5164a06b8c1aaab Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 14:59:23 +0100 Subject: [PATCH 06/21] steep1commit --- Infrastructure/modules/appService.bicep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Infrastructure/modules/appService.bicep b/Infrastructure/modules/appService.bicep index 740e0841..a4311376 100644 --- a/Infrastructure/modules/appService.bicep +++ b/Infrastructure/modules/appService.bicep @@ -2,7 +2,7 @@ param location string param project string param identifier string -// App Service Plan identifier that will host our App Service +// App Service Plan identifier that will host our App Servi param planId string resource app 'Microsoft.Web/sites@2022-03-01' = { @@ -19,4 +19,4 @@ resource app 'Microsoft.Web/sites@2022-03-01' = { } } -output appServiceName string = app.name // Export the App Service name for deployment \ No newline at end of file +output appServiceName string = app.name // Export the App Service name for deployment From 7925f215d93d73152ddabed0ad20fdaa0b140666 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 15:04:39 +0100 Subject: [PATCH 07/21] sss --- Infrastructure/modules/appService.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Infrastructure/modules/appService.bicep b/Infrastructure/modules/appService.bicep index a4311376..49c17f31 100644 --- a/Infrastructure/modules/appService.bicep +++ b/Infrastructure/modules/appService.bicep @@ -14,7 +14,7 @@ resource app 'Microsoft.Web/sites@2022-03-01' = { reserved: true siteConfig: { - linuxFxVersion: 'DOTNETCORE|9.0' // Specify to setup the .NET Core 9.0 runtime (used by our backend API) on the Linux machine under the hood + linuxFxVersion: 'DOTNETCORE|9.0' // Specify to setup t .NET Core 9.0 runtime (used by our backend API) on the Linux machine under the hood } } } From 8c316064890f882581de279ebcc463ad64c86488 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 15:17:38 +0100 Subject: [PATCH 08/21] youpi --- .github/workflows/deploy-infra-and-apps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml index bc8a5d6f..f1f05610 100644 --- a/.github/workflows/deploy-infra-and-apps.yml +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -5,7 +5,7 @@ permissions: env: AZURE_RG_NAME: rg-${{ vars.PROJECT_NAME }}-${{ vars.AZURE_RESOURCE_IDENTIFIER }} - + jobs: deploy_infrastructure: runs-on: ubuntu-latest From e4844c7e4d16a124d1630effca80d4e7a46af03e Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 15:25:58 +0100 Subject: [PATCH 09/21] delete folder --- Infrastructure/main.bicep | 32 --------------------- Infrastructure/modules/appService.bicep | 22 -------------- Infrastructure/modules/appServicePlan.bicep | 20 ------------- 3 files changed, 74 deletions(-) delete mode 100644 Infrastructure/main.bicep delete mode 100644 Infrastructure/modules/appService.bicep delete mode 100644 Infrastructure/modules/appServicePlan.bicep diff --git a/Infrastructure/main.bicep b/Infrastructure/main.bicep deleted file mode 100644 index 733958d1..00000000 --- a/Infrastructure/main.bicep +++ /dev/null @@ -1,32 +0,0 @@ -targetScope = 'resourceGroup' // We'll deploy the resources in the provided resource g - -// Parameters to easily construct resource names -param location string -param project string - -// Here we'll add an identifier to create a unique name for the App Service Plan, for example your trigram, so that everyone could deploy his own parkndeploy instance -param identifier string - -// Create the AppServicePlan through the AppServicePlan module -module appServicePlan 'modules/appServicePlan.bicep' = { - name: 'appServicePlan' - params: { - location: location - project: project - identifier: identifier - } -} - -// Create the AppService through the AppService module -module appService 'modules/appService.bicep' = { - name: 'appService' - params: { - location: location - project: project - identifier: identifier - planId: appServicePlan.outputs.planId // Use the appServicePlan output to get its id back => an App Service needs to reference its App Service Plan - } -} - -// Export App Service Name -output appServiceName string = appService.outputs.appServiceName diff --git a/Infrastructure/modules/appService.bicep b/Infrastructure/modules/appService.bicep deleted file mode 100644 index 49c17f31..00000000 --- a/Infrastructure/modules/appService.bicep +++ /dev/null @@ -1,22 +0,0 @@ -param location string -param project string -param identifier string - -// App Service Plan identifier that will host our App Servi -param planId string - -resource app 'Microsoft.Web/sites@2022-03-01' = { - name: '${project}-app-${identifier}' - location: location - - properties: { - serverFarmId: planId - reserved: true - - siteConfig: { - linuxFxVersion: 'DOTNETCORE|9.0' // Specify to setup t .NET Core 9.0 runtime (used by our backend API) on the Linux machine under the hood - } - } -} - -output appServiceName string = app.name // Export the App Service name for deployment diff --git a/Infrastructure/modules/appServicePlan.bicep b/Infrastructure/modules/appServicePlan.bicep deleted file mode 100644 index c871995f..00000000 --- a/Infrastructure/modules/appServicePlan.bicep +++ /dev/null @@ -1,20 +0,0 @@ -param location string -param project string -param identifier string - -resource plan 'Microsoft.Web/serverfarms@2022-09-01' = { - name: '${project}-plan-${identifier}' - location: location - - sku: { - name: 'F1' // We use F1 pricing plan (free one) as we don't need specific features - } - - kind: 'app,linux' // Allow to deploy on an App Service using Linux OS - - properties: { - reserved: true // Specifity of App Service with Linux OS - } -} - -output planId string = plan.id // Export the App Service identifier \ No newline at end of file From e396797becb25252f1fc58896cbd578bae528594 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 15:26:18 +0100 Subject: [PATCH 10/21] cette fois c'est la bonne --- infrastructure/main.bicep | 32 +++++++++++++++++++++ infrastructure/modules/appService.bicep | 22 ++++++++++++++ infrastructure/modules/appServicePlan.bicep | 20 +++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 infrastructure/main.bicep create mode 100644 infrastructure/modules/appService.bicep create mode 100644 infrastructure/modules/appServicePlan.bicep diff --git a/infrastructure/main.bicep b/infrastructure/main.bicep new file mode 100644 index 00000000..733958d1 --- /dev/null +++ b/infrastructure/main.bicep @@ -0,0 +1,32 @@ +targetScope = 'resourceGroup' // We'll deploy the resources in the provided resource g + +// Parameters to easily construct resource names +param location string +param project string + +// Here we'll add an identifier to create a unique name for the App Service Plan, for example your trigram, so that everyone could deploy his own parkndeploy instance +param identifier string + +// Create the AppServicePlan through the AppServicePlan module +module appServicePlan 'modules/appServicePlan.bicep' = { + name: 'appServicePlan' + params: { + location: location + project: project + identifier: identifier + } +} + +// Create the AppService through the AppService module +module appService 'modules/appService.bicep' = { + name: 'appService' + params: { + location: location + project: project + identifier: identifier + planId: appServicePlan.outputs.planId // Use the appServicePlan output to get its id back => an App Service needs to reference its App Service Plan + } +} + +// Export App Service Name +output appServiceName string = appService.outputs.appServiceName diff --git a/infrastructure/modules/appService.bicep b/infrastructure/modules/appService.bicep new file mode 100644 index 00000000..49c17f31 --- /dev/null +++ b/infrastructure/modules/appService.bicep @@ -0,0 +1,22 @@ +param location string +param project string +param identifier string + +// App Service Plan identifier that will host our App Servi +param planId string + +resource app 'Microsoft.Web/sites@2022-03-01' = { + name: '${project}-app-${identifier}' + location: location + + properties: { + serverFarmId: planId + reserved: true + + siteConfig: { + linuxFxVersion: 'DOTNETCORE|9.0' // Specify to setup t .NET Core 9.0 runtime (used by our backend API) on the Linux machine under the hood + } + } +} + +output appServiceName string = app.name // Export the App Service name for deployment diff --git a/infrastructure/modules/appServicePlan.bicep b/infrastructure/modules/appServicePlan.bicep new file mode 100644 index 00000000..c871995f --- /dev/null +++ b/infrastructure/modules/appServicePlan.bicep @@ -0,0 +1,20 @@ +param location string +param project string +param identifier string + +resource plan 'Microsoft.Web/serverfarms@2022-09-01' = { + name: '${project}-plan-${identifier}' + location: location + + sku: { + name: 'F1' // We use F1 pricing plan (free one) as we don't need specific features + } + + kind: 'app,linux' // Allow to deploy on an App Service using Linux OS + + properties: { + reserved: true // Specifity of App Service with Linux OS + } +} + +output planId string = plan.id // Export the App Service identifier \ No newline at end of file From 94c972845854ba9da04bf24633aeadfecfadeb2b Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 15:37:51 +0100 Subject: [PATCH 11/21] steep1Bonne --- .github/workflows/deploy-infra-and-apps.yml | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml index f1f05610..be356fa9 100644 --- a/.github/workflows/deploy-infra-and-apps.yml +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -11,6 +11,9 @@ jobs: runs-on: ubuntu-latest environment: production + outputs: + appServiceName: ${{ steps.bicep_deploy.outputs.appServiceName }} + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -39,3 +42,33 @@ jobs: resourceGroupName: ${{ env.AZURE_RG_NAME }} + deploy_backend: + runs-on: ubuntu-latest + needs: deploy_infrastructure + environment: production + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET SDK 9.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + + - name: Publish the app + run: dotnet publish -c Release --property:PublishDir=publish # Publish the app to the API project publish folder + working-directory: ./backend # Specify where to find the solution file in repository + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: Deploy backend to App Service + uses: azure/webapps-deploy@v2 + with: + app-name: ${{ needs.deploy_infrastructure.outputs.appServiceName }} # Access to the previous job output to get the appServiceName deployed with bicep + package: ./backend/ParkNDeploy.Api/publish # Path to the previously published app \ No newline at end of file From aefc1eafe2597060e93fd705b72ab0cc74d8e703 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 15:57:48 +0100 Subject: [PATCH 12/21] step2part1commit --- .github/workflows/deploy-infra-and-apps.yml | 2 +- infrastructure/main.bicep | 17 +++++++++++++++-- infrastructure/modules/staticWebApp.bicep | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 infrastructure/modules/staticWebApp.bicep diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml index be356fa9..046175c4 100644 --- a/.github/workflows/deploy-infra-and-apps.yml +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -38,7 +38,7 @@ jobs: subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} region: ${{ secrets.AZURE_REGION }} template: ./infrastructure/main.bicep - parameters: project=${{ vars.PROJECT_NAME }} location=${{ secrets.AZURE_REGION }} identifier=${{ vars.AZURE_RESOURCE_IDENTIFIER }} + parameters: project=${{ vars.PROJECT_NAME }} location=${{ secrets.AZURE_REGION }} swaLocation=${{ secrets.AZURE_SWA_REGION }} identifier=${{ vars.AZURE_RESOURCE_IDENTIFIER }} resourceGroupName: ${{ env.AZURE_RG_NAME }} diff --git a/infrastructure/main.bicep b/infrastructure/main.bicep index 733958d1..cddb78b2 100644 --- a/infrastructure/main.bicep +++ b/infrastructure/main.bicep @@ -6,6 +6,7 @@ param project string // Here we'll add an identifier to create a unique name for the App Service Plan, for example your trigram, so that everyone could deploy his own parkndeploy instance param identifier string +param swaLocation string // Static Web App locations are limited, we need to add another variable // Create the AppServicePlan through the AppServicePlan module module appServicePlan 'modules/appServicePlan.bicep' = { @@ -28,5 +29,17 @@ module appService 'modules/appService.bicep' = { } } -// Export App Service Name -output appServiceName string = appService.outputs.appServiceName + + + +module staticWebApp 'modules/staticWebApp.bicep' = { + name: 'staticWebApp' + params: { + location: swaLocation + project: project + identifier: identifier + } +} + +output appServiceName string = appService.outputs.appServiceName // Export AppServiceName in order to deploy the API later on +output staticWebAppName string = staticWebApp.outputs.swaName // Export StaticWebAppName in order to deploy the Frontend late diff --git a/infrastructure/modules/staticWebApp.bicep b/infrastructure/modules/staticWebApp.bicep new file mode 100644 index 00000000..672a6365 --- /dev/null +++ b/infrastructure/modules/staticWebApp.bicep @@ -0,0 +1,19 @@ +param location string +param project string + +// Here we'll use add an identifier to create a unique name for the App Service Plan, for example your trigram, so that everyone could deploy his own parkndeploy instance +param identifier string + +resource swa 'Microsoft.Web/staticSites@2024-04-01' = { + name: '${project}-swa-${identifier}' + location: location + + sku: { + name: 'Standard' + tier: 'Standard' + } + + properties: {} // even empty, it's mandatory ... +} + +output swaName string = swa.name From 1ef03dd4cb7fba93e6d41a360cec3d2273d5005f Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 16:11:52 +0100 Subject: [PATCH 13/21] STEEP2commit part2 --- .github/workflows/deploy-infra-and-apps.yml | 31 ++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml index 046175c4..287179e5 100644 --- a/.github/workflows/deploy-infra-and-apps.yml +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -13,6 +13,7 @@ jobs: outputs: appServiceName: ${{ steps.bicep_deploy.outputs.appServiceName }} + staticWebAppName: ${{ steps.bicep_deploy.outputs.staticWebAppName }} steps: - name: Checkout repository @@ -71,4 +72,32 @@ jobs: uses: azure/webapps-deploy@v2 with: app-name: ${{ needs.deploy_infrastructure.outputs.appServiceName }} # Access to the previous job output to get the appServiceName deployed with bicep - package: ./backend/ParkNDeploy.Api/publish # Path to the previously published app \ No newline at end of file + package: ./backend/ParkNDeploy.Api/publish # Path to the previously published app + + deploy_frontend: + runs-on: ubuntu-latest + needs: deploy_infrastructure + environment: production + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build the app + run: npm install && npm run build + working-directory: ./frontend + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: Deploy frontend to Static Web App + uses: azure/static-web-apps-deploy@v1 + with: + app_location: frontend/dist + action: upload + skip_app_build: true + skip_api_build: true From eaff256666b9cce545a643ffcf8107d5b313dd4b Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 16:22:12 +0100 Subject: [PATCH 14/21] step2commitBonne --- .github/workflows/deploy-infra-and-apps.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml index 287179e5..aafc7ba3 100644 --- a/.github/workflows/deploy-infra-and-apps.yml +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -93,11 +93,17 @@ jobs: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - + + - name: Get Static Web App deployment token + run: | + SWA_DEPLOYMENT_TOKEN=$(az staticwebapp secrets list -n ${{ needs.deploy_infrastructure.outputs.staticWebAppName }} -o tsv --query properties.apiKey) + echo SWA_DEPLOYMENT_TOKEN=$SWA_DEPLOYMENT_TOKEN >> $GITHUB_ENV + - name: Deploy frontend to Static Web App uses: azure/static-web-apps-deploy@v1 with: + azure_static_web_apps_api_token: ${{ env.SWA_DEPLOYMENT_TOKEN }} app_location: frontend/dist action: upload skip_app_build: true - skip_api_build: true + skip_api_build: true \ No newline at end of file From 433bfee0484305f2f9f1127114ef6572cd9e8e79 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 16:33:50 +0100 Subject: [PATCH 15/21] steep3commitBonne --- infrastructure/main.bicep | 9 +++++++++ infrastructure/modules/appService.bicep | 1 + infrastructure/modules/staticWebAppBackend.bicep | 11 +++++++++++ 3 files changed, 21 insertions(+) create mode 100644 infrastructure/modules/staticWebAppBackend.bicep diff --git a/infrastructure/main.bicep b/infrastructure/main.bicep index cddb78b2..9c52dd00 100644 --- a/infrastructure/main.bicep +++ b/infrastructure/main.bicep @@ -41,5 +41,14 @@ module staticWebApp 'modules/staticWebApp.bicep' = { } } +module staticWebAppBackend 'modules/staticWebAppBackend.bicep' = { + name: 'staticWebAppBackend' + params: { + backendBindedResourceId: appService.outputs.appServiceId + swaName: staticWebApp.outputs.swaName + location: location + } +} + output appServiceName string = appService.outputs.appServiceName // Export AppServiceName in order to deploy the API later on output staticWebAppName string = staticWebApp.outputs.swaName // Export StaticWebAppName in order to deploy the Frontend late diff --git a/infrastructure/modules/appService.bicep b/infrastructure/modules/appService.bicep index 49c17f31..c0e5d89c 100644 --- a/infrastructure/modules/appService.bicep +++ b/infrastructure/modules/appService.bicep @@ -20,3 +20,4 @@ resource app 'Microsoft.Web/sites@2022-03-01' = { } output appServiceName string = app.name // Export the App Service name for deployment +output appServiceId string = app.id diff --git a/infrastructure/modules/staticWebAppBackend.bicep b/infrastructure/modules/staticWebAppBackend.bicep new file mode 100644 index 00000000..4e902770 --- /dev/null +++ b/infrastructure/modules/staticWebAppBackend.bicep @@ -0,0 +1,11 @@ +param backendBindedResourceId string +param swaName string +param location string + +resource staticWebAppBackend 'Microsoft.Web/staticSites/linkedBackends@2022-03-01' = { + name: '${swaName}/backend' + properties: { + backendResourceId: backendBindedResourceId + region: location + } +} From 50f0d2eeb646a6a2540dae9c6e86eae1a5b8319f Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Tue, 20 Jan 2026 17:42:10 +0100 Subject: [PATCH 16/21] commit tag --- .github/workflows/deploy-infra-and-apps.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml index aafc7ba3..46e1b533 100644 --- a/.github/workflows/deploy-infra-and-apps.yml +++ b/.github/workflows/deploy-infra-and-apps.yml @@ -1,4 +1,9 @@ -on: [push, workflow_dispatch] +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + workflow_dispatch: + permissions: id-token: write From 772d8f7179cf43c778ac0f226d6ef0ef9e6f2a8c Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Wed, 21 Jan 2026 08:24:54 +0100 Subject: [PATCH 17/21] add merge request pipeline (frontend + backend) --- .github/workflows/ci-merge-request.yml | 54 ++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/ci-merge-request.yml diff --git a/.github/workflows/ci-merge-request.yml b/.github/workflows/ci-merge-request.yml new file mode 100644 index 00000000..9da0f9b0 --- /dev/null +++ b/.github/workflows/ci-merge-request.yml @@ -0,0 +1,54 @@ +name: CI - Merge Request + +on: + pull_request: + branches: + - main + +jobs: + frontend_ci: + name: Frontend CI + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install frontend dependencies + run: npm install + working-directory: ./frontend + + - name: Build React app + run: npm run build + working-directory: ./frontend + + - name: Run frontend lint + run: npm run lint + working-directory: ./frontend + + + backend_ci: + name: Backend CI + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + + - name: Restore backend dependencies + run: dotnet restore + working-directory: ./backend + + - name: Build backend (Release) + run: dotnet build -c Release + working-directory: ./backend From 1afd9d9257fab10ddc67350afed023b23b6ad390 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Wed, 21 Jan 2026 08:25:06 +0100 Subject: [PATCH 18/21] test --- .github/workflows/ci-merge-request.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-merge-request.yml b/.github/workflows/ci-merge-request.yml index 9da0f9b0..a6ea2e79 100644 --- a/.github/workflows/ci-merge-request.yml +++ b/.github/workflows/ci-merge-request.yml @@ -50,5 +50,4 @@ jobs: working-directory: ./backend - name: Build backend (Release) - run: dotnet build -c Release - working-directory: ./backend + run: dotnet build -c From 5647614032a9a32e2e370fe9e8859b5191e284e5 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Wed, 21 Jan 2026 09:49:27 +0100 Subject: [PATCH 19/21] ci release commit --- .github/workflows/ci-release.yml | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/ci-release.yml diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml new file mode 100644 index 00000000..b8408785 --- /dev/null +++ b/.github/workflows/ci-release.yml @@ -0,0 +1,71 @@ +name: CI Release + +# Ce workflow peut être déclenché manuellement pour une release +on: + workflow_dispatch: + +jobs: + # Job Frontend + frontend_release: + name: Frontend Release + runs-on: ubuntu-latest + + steps: + # Récupérer le code du repository + - name: Checkout repository + uses: actions/checkout@v4 + + # Installer Node.js + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + # Installer les dépendances + - name: Install frontend dependencies + run: npm install + working-directory: ./frontend + + # Build l'application React + - name: Build React app + run: npm run build + working-directory: ./frontend + + # Upload l'artifact frontend pour le CD + - name: Upload frontend artifact + uses: actions/upload-artifact@v3 + with: + name: frontend-build + path: ./frontend/build # Dossier généré par npm run build + + # Job Backend + backend_release: + name: Backend Release + runs-on: ubuntu-latest + + steps: + # Récupérer le code du repository + - name: Checkout repository + uses: actions/checkout@v4 + + # Installer le SDK .NET + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + + # Restaurer les dépendances .NET + - name: Restore backend dependencies + run: dotnet restore + working-directory: ./backend + + - name: Publish backend + run: dotnet publish ./NomDuProjet.csproj -c Release -o ./publish + working-directory: ./backend + + + - name: Upload backend artifact + uses: actions/upload-artifact@v3 + with: + name: backend-build + path: ./backend/publish From 33a87b8d8075abdd0046a6363504c111f2d88615 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Wed, 21 Jan 2026 09:56:17 +0100 Subject: [PATCH 20/21] test --- .github/workflows/ci-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index b8408785..10ddf4f9 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -59,11 +59,12 @@ jobs: run: dotnet restore working-directory: ./backend + # Publier le backend (build Release) et créer le dossier publish - name: Publish backend run: dotnet publish ./NomDuProjet.csproj -c Release -o ./publish working-directory: ./backend - + # Upload l'artifact backend pour le CD - name: Upload backend artifact uses: actions/upload-artifact@v3 with: From b38373cb0240817ae0f86df97a97a2127b2f72e6 Mon Sep 17 00:00:00 2001 From: imanDoumi Date: Wed, 21 Jan 2026 10:03:33 +0100 Subject: [PATCH 21/21] exo3commit --- .github/workflows/ci-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 10ddf4f9..01750aa0 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -61,7 +61,7 @@ jobs: # Publier le backend (build Release) et créer le dossier publish - name: Publish backend - run: dotnet publish ./NomDuProjet.csproj -c Release -o ./publish + run: dotnet publish ./parkndeployDoumi.csproj -c Release -o ./publish working-directory: ./backend # Upload l'artifact backend pour le CD