Workflow file for this run
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: Azure Static Web Apps CI/CD | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, closed] | ||
| branches: | ||
| - main | ||
| jobs: | ||
| build_and_deploy_job: | ||
| if: github.event_name == 'push' || | ||
| (github.event_name == 'pull_request' && github.event.action != 'closed') | ||
| runs-on: ubuntu-latest | ||
| name: Build and Deploy Job | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| submodules: true | ||
| lfs: false | ||
| - name: Setup .NET SDK | ||
| uses: actions/setup-dotnet@v3 | ||
| with: | ||
| dotnet-version: '8.0.x' | ||
| - name: Cache NuGet packages | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.nuget/packages | ||
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-nuget- | ||
| - name: Cache .NET Workload Packs | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.dotnet | ||
| key: ${{ runner.os }}-dotnet-workloads-${{ hashFiles('**/*.csproj') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-dotnet-workloads- | ||
| - name: Install WASM Tools workload | ||
| run: dotnet workload install wasm-tools | ||
| - name: Publish Blazor WebAssembly (AOT + Brotli) | ||
| run: dotnet publish ./Client -c Release \ | ||
| /p:BlazorWebAssemblyEnableAOT=true \ | ||
| /p:CompressionEnabled=true | ||
| - name: Build and Deploy to Azure Static Web Apps | ||
| uses: Azure/static-web-apps-deploy@v1 | ||
| with: | ||
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_WATER_0BADFAE10 }} | ||
| repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
| action: upload | ||
| app_location: ./Client | ||
| api_location: Api | ||
| output_location: wwwroot | ||
| close_pull_request_job: | ||
| if: github.event_name == 'pull_request' && | ||
| github.event.action == 'closed' | ||
| runs-on: ubuntu-latest | ||
| name: Close Pull Request Job | ||
| steps: | ||
| - name: Close Preview | ||
| uses: Azure/static-web-apps-deploy@v1 | ||
| with: | ||
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_WATER_0BADFAE10 }} | ||
| action: close | ||