From 2199d777004bf5b46b8681664f9c5dc181f1f1cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez?= <39990341+rfernandezdo@users.noreply.github.com> Date: Fri, 30 May 2025 08:28:07 +0200 Subject: [PATCH 1/3] Create deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml Pipeline with OIDC --- ...tool-to-azure-webapps-dotnet-core-oidc.yml | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml diff --git a/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml b/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml new file mode 100644 index 00000000..46ceb470 --- /dev/null +++ b/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml @@ -0,0 +1,107 @@ +# This workflow builds and deploys a .NET Core application to an Azure Web App when a push is made to the main branch. +# +# This workflow assumes you have already created the target Azure App Service Web App. +# For instructions, see: https://docs.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?tabs=net60&pivots=development-environment-vscode +# +# Workflow setup: +# +# 1. Create the following secrets in your repository: +# - AZURE_CLIENT_ID: The ID of your Azure AD registered application. +# - AZURE_TENANT_ID: Your Azure AD tenant ID. +# - AZURE_SUBSCRIPTION_ID: Your Azure subscription ID. +# - AZURE_WEBAPP_NAME: The name of your Azure App Service. +# +# This workflow uses OIDC authentication to securely connect to Azure. +# +# More information about GitHub Actions for Azure: https://github.com/Azure/Actions +# More information about the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More workflow samples for deploying to Azure: https://github.com/Azure/actions-workflow-samples + +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy ASP.Net Core app to Azure Web App - azurenamingtool + +env: + AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root + AZURE_WEBAPP_SLOT_NAME: 'Production' + DOTNET_VERSION: '8.0.x' + + +on: + push: + branches: + - main + workflow_dispatch: + + +defaults: + run: + working-directory: src + +permissions: + contents: read + + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: src + permissions: + contents: read #This is required for actions/checkout + + steps: + - uses: actions/checkout@v4 + + - name: Set up .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Build with dotnet + run: dotnet build --configuration Release + + - name: dotnet publish + run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4 + with: + name: .net-app + path: ${{env.DOTNET_ROOT}}/myapp + + deploy: + defaults: + run: + working-directory: ready/AzNamingTool + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + permissions: + id-token: write #This is required for requesting the JWT + contents: read #This is required for actions/checkout + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: .net-app + + - 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 to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v3 + with: + app-name: ${{ secrets.AZURE_WEBAPP_NAME }} + slot-name: ${{env.AZURE_WEBAPP_SLOT_NAME}} + package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} From 8cf3112706f9d0abb4d07ce4af0e90e1ed6a7c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez?= <39990341+rfernandezdo@users.noreply.github.com> Date: Wed, 22 Oct 2025 23:11:42 +0200 Subject: [PATCH 2/3] Update .github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- ...ploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml b/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml index 46ceb470..1c3c2983 100644 --- a/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml +++ b/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml @@ -75,7 +75,7 @@ jobs: deploy: defaults: run: - working-directory: ready/AzNamingTool + working-directory: . runs-on: ubuntu-latest needs: build environment: From eb92fee0a68e259b855d3ac0e82c123bc22207cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez?= <39990341+rfernandezdo@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:10:22 +0100 Subject: [PATCH 3/3] Update DOTNET_VERSION to 10.0.x in workflow --- ...ploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml b/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml index 1c3c2983..5371fe24 100644 --- a/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml +++ b/.github/workflows/deploy-azure-naming-tool-to-azure-webapps-dotnet-core-oidc.yml @@ -25,7 +25,7 @@ name: Build and deploy ASP.Net Core app to Azure Web App - azurenamingtool env: AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root AZURE_WEBAPP_SLOT_NAME: 'Production' - DOTNET_VERSION: '8.0.x' + DOTNET_VERSION: '10.0.x' on: