update: implement caching + invalidation + optimistic locking + retry… #14
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 and deploy .NET Core application to Web App blood-donation-api with API Management Service BloodDonationSupportSystemApi-BloodDonationSupportSystem | |
| on: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| AZURE_WEBAPP_NAME: blood-donation-api | |
| AZURE_WEBAPP_PACKAGE_PATH: BloodDonationSupportSystem\publish | |
| AZURE_APIM_RESOURCE_PATH: / | |
| AZURE_APIM_RESOURCEGROUP: bdss-rg | |
| AZURE_APIM_SERVICENAME: BloodDonationSupportSystemApi | |
| AZURE_APIM_API_ID: BloodDonationSupportSystem | |
| AZURE_APIM_APPSERVICEURL: https://blood-donation-api-asb9esgvbfhwfhbf.southeastasia-01.azurewebsites.net | |
| SWASHBUCLE_ASPNET_CORE_CLI_PACKAGE_VERSION: 8.1.1 | |
| SWASHBUCKLE_DOTNET_CORE_VERSION: 8.x | |
| API_IMPORT_SPECIFICATION_PATH: BloodDonationSupportSystem\publish\swagger.json | |
| API_IMPORT_DLL: BloodDonationSupportSystem\bin\Release\net8.0\BloodDonationSupportSystem.dll | |
| API_IMPORT_VERSION: v1 | |
| CONFIGURATION: Release | |
| DOTNET_CORE_VERSION: 8.0.x | |
| WORKING_DIRECTORY: BloodDonationSupportSystem | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_CORE_VERSION }} | |
| - name: Setup SwashBuckle .NET Core | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.SWASHBUCKLE_DOTNET_CORE_VERSION }} | |
| - name: Restore | |
| run: dotnet restore "${{ env.WORKING_DIRECTORY }}" | |
| - name: Build | |
| run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore | |
| - name: Test | |
| run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build | |
| - name: Publish | |
| run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}" | |
| # Temporarily disable Swagger generation due to runtime compatibility issues | |
| # - name: Install Swashbuckle CLI .NET Global Tool | |
| # run: dotnet tool install --global Swashbuckle.AspNetCore.Cli --version ${{ env.SWASHBUCLE_ASPNET_CORE_CLI_PACKAGE_VERSION }} | |
| # working-directory: ${{ env.WORKING_DIRECTORY }} | |
| # - name: Generate Open API Specification Document | |
| # run: swagger tofile --serializeasv2 --output "${{ env.API_IMPORT_SPECIFICATION_PATH }}" "${{ env.API_IMPORT_DLL }}" "${{ env.API_IMPORT_VERSION }}" | |
| - name: Publish Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: webapp | |
| path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |
| deploy: | |
| runs-on: windows-latest | |
| needs: build | |
| steps: | |
| - name: Download artifact from build job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: webapp | |
| path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |
| - name: Azure Login | |
| uses: azure/login@v2 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| - name: Deploy to Azure WebApp | |
| uses: azure/webapps-deploy@v2 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |
| - name: logout | |
| run: > | |
| az logout |