Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b061e92
creation des fichiers d'infrastructure et deploiement apps workflows
husimo123 Jan 14, 2026
b3b4e7a
modif deploy_infrastructure job to bind it to production environment
husimo123 Jan 14, 2026
7280e19
added backend deployment to production environment
husimo123 Jan 14, 2026
0b198be
fixed indentation
husimo123 Jan 14, 2026
1010c07
fixed missing line
husimo123 Jan 14, 2026
f9f7235
added static web app module and integrated it into main bicep and wor…
husimo123 Jan 14, 2026
589d9cf
frontend deployment and backend deployment to use the correct Static …
husimo123 Jan 14, 2026
d5e647a
fixed indentation (again)
husimo123 Jan 14, 2026
d92eb8f
added static web app deployment and outputs
husimo123 Jan 14, 2026
28b2fd1
more front
husimo123 Jan 14, 2026
db94f8b
changed some stuff
husimo123 Jan 14, 2026
28ea071
ouio ui
husimo123 Jan 14, 2026
980b0de
Tag rule to force deployment only on correct version tags 'v[0-9].[0-…
husimo123 Jan 20, 2026
3d72829
gros test qui va surment pas marcher pour le pull request
husimo123 Jan 20, 2026
55bba14
ajout de deploy infra
husimo123 Jan 20, 2026
76c1e07
j'ai retiré une ligne en trop dans le fichier deploy-infra-and-app-PR…
husimo123 Jan 20, 2026
0dbfbdd
small bug fix (merci dodo)
husimo123 Jan 20, 2026
6d41084
tes nul dodo
husimo123 Jan 20, 2026
c34a810
je fais nimp
husimo123 Jan 20, 2026
de20776
create CI pipe,
husimo123 Jan 20, 2026
b29dbec
je test un truc
husimo123 Jan 20, 2026
09ecd94
creation de la pipiline cicd
husimo123 Jan 21, 2026
55ae786
fixed the CICD pipeline deployment jobs
husimo123 Jan 21, 2026
9313177
dunno i just removec some blank lines and a commented on
husimo123 Jan 21, 2026
9c106a2
en mettant les artefact c'est mieux
husimo123 Jan 21, 2026
d07a834
avec d'autres fichiers qui plantent aussi...
husimo123 Jan 21, 2026
e0aa52d
yen a marre de ce fichier
husimo123 Jan 21, 2026
247c4ce
encore un fichier de con qui membete
husimo123 Jan 21, 2026
94d7551
jen sais rien de ce que je fais la
husimo123 Jan 21, 2026
af75557
j'avais un truc de trop dans deploy infra pr
husimo123 Jan 21, 2026
0c16031
mise en parallele
husimo123 Jan 21, 2026
f661840
je fix un truc en mettant exactemetn la meme chose
husimo123 Jan 21, 2026
505dadd
ils seront pas en parrelle et c'est tres bien comme ca
husimo123 Jan 21, 2026
2fb8d77
fixed indenation
husimo123 Jan 21, 2026
62fd2ef
indenation 115
husimo123 Jan 21, 2026
a276c16
changed frontent deployment name
husimo123 Jan 21, 2026
3866089
removed paths
husimo123 Jan 21, 2026
db17fe8
remis le path dans le build
husimo123 Jan 21, 2026
e5606bf
changed some paths
husimo123 Jan 21, 2026
4cc6f17
test app location
husimo123 Jan 21, 2026
b029683
changement de version artefact
husimo123 Jan 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/deploy-infra-and-app-PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
pull_request:
branches:
- main
jobs:
build-reactapp-lint-frontend-job:
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build the react app - production mode
run: npm install && npm run build
working-directory: ./frontend

- name: Run the linting script
run: npm run lint
working-directory: ./frontend

build-dotnet-app-release-backend-job:
runs-on: ubuntu-latest
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: Build the dotnet app in release mode
run: dotnet build --configuration Release
working-directory: ./backend



175 changes: 175 additions & 0 deletions .github/workflows/deploy-infra-and-apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
on:
push:
tags:
- 'v[0-9].[0-9].[0-9]'
workflow_dispatch:


permissions:
# Require write permission to Fetch an OIDC token (required for federated credential) and write it
# It will be automatically used on actions / cli that needs it
id-token: write



env:
AZURE_RG_NAME: rg-${{ vars.PROJECT_NAME }}-${{ vars.AZURE_RESOURCE_IDENTIFIER }}

jobs:
build-reactapp-lint-frontend-job:
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build the react app - production mode
run: npm install && npm run build
working-directory: ./frontend

- name: 'Createa artefact frontend'
uses: actions/upload-artifact@v4
with:
name: react-frontend-build
path : ./frontend

build-dotnet-app-release-backend-job:
runs-on: ubuntu-latest
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: Build the dotnet app in release mode
run: dotnet build --configuration Release
working-directory: ./backend


- name: 'Create artefact'
uses: actions/upload-artifact@v4
with:
name: dotnet-backend-build
path : ./backend

deploy_infrastructure:
runs-on: ubuntu-latest
needs : [build-dotnet-app-release-backend-job, build-reactapp-lint-frontend-job] # Ensure this job runs after the pull_request job
environment: production # bind the job to the production environment
outputs:
appServiceName: ${{ steps.bicep_deploy.outputs.appServiceName }}
staticWebAppName: ${{ steps.bicep_deploy.outputs.staticWebAppName }}
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 }} swaLocation=${{ secrets.AZURE_SWA_REGION }} identifier=${{ vars.AZURE_RESOURCE_IDENTIFIER }}
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 : Deploy artefact backend
uses : actions/download-artifact@v5
with :
name : dotnet-backend-build
path : ./backend



- 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
# deploy_infrastructure ...

deploy_frontend:
runs-on: ubuntu-latest
needs: deploy_infrastructure
environment: production

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name : Deploy artefact frontend
uses : actions/download-artifact@v5
with :
name : react-frontend-build
path : ./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 }}

# Login to Azure
# ...

- 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

# Deploy frontend to Static Web App
# ...

- 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
action: upload
skip_app_build: true
skip_api_build: true

50 changes: 50 additions & 0 deletions infrastructure/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
targetScope = 'resourceGroup' // We'll deploy the resources in the provided resource group

// Parameters to easily construct resource names
param location string
param project string
param swaLocation string // Static Web App locations are limited, we need to add another variable
// 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
}
}

module staticWebApp 'modules/staticWebApp.bicep' = {
name: 'staticWebApp'
params: {
location: swaLocation
project: project
identifier: identifier
}
}
module staticWebAppBackend 'modules/staticWebAppBackEnd.bicep' = {
name: 'staticWebAppBackend'
params: {
backendBindedResourceId: appService.outputs.appServiceId
swaName: staticWebApp.outputs.swaName
location: location
}
}
// Export App Service Name

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
24 changes: 24 additions & 0 deletions infrastructure/modules/appService.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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

output appServiceId string = app.id
20 changes: 20 additions & 0 deletions infrastructure/modules/appServicePlan.bicep
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions infrastructure/modules/staticWebApp.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
param location string
param project string
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 // Expose Static Web App name as we did for App Service for deployment purpose
12 changes: 12 additions & 0 deletions infrastructure/modules/staticWebAppBackEnd.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
}
}