From b43f0d4afd94e210ba3a00464f2709a6a8d4938a Mon Sep 17 00:00:00 2001 From: Byron Delgado <92735588+bdelgado90@users.noreply.github.com> Date: Sun, 16 Jun 2024 17:58:30 -0600 Subject: [PATCH 1/2] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_librarywebapidemo.yml | 66 ++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/main_librarywebapidemo.yml diff --git a/.github/workflows/main_librarywebapidemo.yml b/.github/workflows/main_librarywebapidemo.yml new file mode 100644 index 0000000..9cf74e6 --- /dev/null +++ b/.github/workflows/main_librarywebapidemo.yml @@ -0,0 +1,66 @@ +# 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 - LibraryWebApiDemo + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '8.x' + include-prerelease: true + + - 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@v3 + with: + name: .net-app + path: ${{env.DOTNET_ROOT}}/myapp + + deploy: + 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 + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v3 + with: + name: .net-app + + - name: Login to Azure + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_75A5888BA55B48C486A291C95836692F }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_DC4291B1C905428EA372A87E71415FC1 }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_E89539706F714947A2928AC66B87113D }} + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'LibraryWebApiDemo' + slot-name: 'Production' + package: . + \ No newline at end of file From fcad9eeda53cb4122eb0bc2cb5efd560b3e16c48 Mon Sep 17 00:00:00 2001 From: Byron Delgado <92735588+bdelgado90@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:19:16 -0600 Subject: [PATCH 2/2] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_librarywebapidemo.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main_librarywebapidemo.yml b/.github/workflows/main_librarywebapidemo.yml index 9cf74e6..65cd7c8 100644 --- a/.github/workflows/main_librarywebapidemo.yml +++ b/.github/workflows/main_librarywebapidemo.yml @@ -1,7 +1,7 @@ # 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 - LibraryWebApiDemo +name: Build and deploy ASP.Net Core app to Azure Web App - librarywebapidemo on: push: @@ -40,27 +40,18 @@ jobs: environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} - permissions: - id-token: write #This is required for requesting the JWT steps: - name: Download artifact from build job uses: actions/download-artifact@v3 with: name: .net-app - - - name: Login to Azure - uses: azure/login@v1 - with: - client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_75A5888BA55B48C486A291C95836692F }} - tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_DC4291B1C905428EA372A87E71415FC1 }} - subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_E89539706F714947A2928AC66B87113D }} - name: Deploy to Azure Web App id: deploy-to-webapp uses: azure/webapps-deploy@v2 with: - app-name: 'LibraryWebApiDemo' + app-name: 'librarywebapidemo' slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_BD375821D80E44E69A693203A903B277 }} package: . - \ No newline at end of file