StaticWebApp (Blazor WebAssembly) #559
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: StaticWebApp (Blazor WebAssembly) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| prod_release: | |
| description: 'Do you want to release to production?' | |
| required: true | |
| default: false | |
| type: boolean | |
| jobs: | |
| build_and_deploy_job: | |
| if: ${{ inputs.prod_release }} || (github.event_name == 'pull_request' && github.event.action != 'closed') | |
| runs-on: ubuntu-latest | |
| env: | |
| DOTNET_VERSION: "net10.0" | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| PROJECT: "BlazorBootstrap.Demo.WebAssembly/BlazorBootstrap.Demo.WebAssembly.csproj" | |
| BUILD_CONFIG: "Release" | |
| name: Build and Deploy Job | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| lfs: false | |
| # Setup .NET 10.0 | |
| - name: Setup .NET 10.0 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| # .NET Restore | |
| - name: .NET Restore | |
| run: dotnet restore ${{ env.PROJECT }} | |
| # .NET Build | |
| - name: .NET Build | |
| run: dotnet build ${{ env.PROJECT }} -c ${{ env.BUILD_CONFIG }} -f ${{ env.DOTNET_VERSION }} --no-restore | |
| # .NET Publish | |
| - name: .NET Publish | |
| run: dotnet publish ${{ env.PROJECT }} -c ${{ env.BUILD_CONFIG }} -o publish -f ${{ env.DOTNET_VERSION }} --no-build | |
| # Azure Static Web App Deployment Action | |
| - name: Build And Deploy Blazor WASM App | |
| id: swa | |
| uses: azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }} | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| action: "upload" | |
| app_location: "publish/wwwroot" | |
| api_location: "" | |
| output_location: "publish/wwwroot" | |
| skip_api_build: true | |
| skip_app_build: true | |
| 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 Pull Request | |
| id: closepullrequest | |
| uses: azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }} | |
| action: "close" |