Merge pull request #49 from flcdrg/dependabot/nuget/net9/FuncWithAddS… #145
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Azure Function App .NET | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| concurrency: | |
| # Ensure only one run of this workflow executes at a time across the repo. | |
| # New runs will be queued until the current run completes. | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| env: | |
| AZURE_FUNCTIONAPP_NAME: "your-app-name" # set this to your function app name on Azure | |
| AZURE_FUNCTIONAPP_PACKAGE_PATH: "DemoFunctionNet6" # set this to the path to your function app project, defaults to the repository root | |
| CONFIGURATION: "Release" | |
| jobs: | |
| infrastructure: | |
| runs-on: ubuntu-latest | |
| environment: dev | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: "Checkout GitHub Action" | |
| uses: actions/checkout@v6 | |
| - name: "Login via Azure CLI" | |
| 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 Bicep | |
| uses: azure/bicep-deploy@v2 | |
| with: | |
| type: deploymentStack | |
| operation: create | |
| name: Development | |
| location: australiaeast | |
| scope: resourceGroup | |
| resource-group-name: rg-funcs-logging-australiaeast | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| template-file: ./infra/main.bicep | |
| action-on-unmanage-resources: delete | |
| deny-settings-mode: none | |
| build-and-deploy: | |
| needs: infrastructure | |
| permissions: | |
| contents: read | |
| id-token: write | |
| strategy: | |
| matrix: | |
| include: | |
| - DOTNET_VERSION: "8.0.x" | |
| directory: net8 | |
| - DOTNET_VERSION: "9.0.x" | |
| directory: net9 | |
| runs-on: ubuntu-latest | |
| environment: dev | |
| steps: | |
| - name: "Checkout GitHub Action" | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup DotNet ${{ matrix.DOTNET_VERSION}} Environment | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ matrix.DOTNET_VERSION}} | |
| - name: "Build .NET" | |
| working-directory: ${{ matrix.directory }} | |
| run: | | |
| dotnet publish Func --output $RUNNER_TEMP/output | |
| dotnet publish FuncWithSerilog --output $RUNNER_TEMP/output-serilog | |
| - name: "Login via Azure CLI" | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: "Publish Azure Functions ${{ matrix.directory}}" | |
| uses: Azure/functions-action@v1 | |
| with: | |
| app-name: func-funcs-${{ matrix.directory}}-logging-australiaeast | |
| package: "${{ runner.temp }}/output" | |
| - name: "Publish Azure Functions ${{ matrix.directory}} with Serilog" | |
| uses: Azure/functions-action@v1 | |
| with: | |
| app-name: func-funcs-${{ matrix.directory}}-serilog-logging-australiaeast | |
| package: "${{ runner.temp }}/output-serilog" |