diff --git a/.github/workflows/deploy-infra-and-app-PR.yml b/.github/workflows/deploy-infra-and-app-PR.yml
new file mode 100644
index 00000000..d71ed925
--- /dev/null
+++ b/.github/workflows/deploy-infra-and-app-PR.yml
@@ -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
+
+
+
diff --git a/.github/workflows/deploy-infra-and-apps.yml b/.github/workflows/deploy-infra-and-apps.yml
new file mode 100644
index 00000000..a270fdfb
--- /dev/null
+++ b/.github/workflows/deploy-infra-and-apps.yml
@@ -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
+
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index f4a4f550..ef1ce6a6 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "frontend",
- "version": "0.0.0",
+ "version": "v.1.1.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "frontend",
- "version": "0.0.0",
+ "version": "v.1.1.1",
"dependencies": {
"@radix-ui/react-icons": "^1.3.2",
"@tanstack/react-query": "^5.84.1",
diff --git a/frontend/package.json b/frontend/package.json
index a0946957..198c748f 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,7 +1,7 @@
{
"name": "frontend",
"private": true,
- "version": "0.0.0",
+ "version": "v.1.1.1",
"type": "module",
"scripts": {
"dev": "vite --port 5175",
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 986ff9bb..0391a7c2 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -31,6 +31,8 @@ function App() {
{isPending &&
App version : {APP_VERSION}
); } diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts index 11f02fe2..28929cce 100644 --- a/frontend/src/vite-env.d.ts +++ b/frontend/src/vite-env.d.ts @@ -1 +1,2 @@ ///