|
1 | | -name: StaticWebApp (Blazor WebAssembly) |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - pull_request: |
8 | | - types: [opened, synchronize, reopened, closed] |
9 | | - branches: |
10 | | - - main |
11 | | - workflow_dispatch: |
12 | | - inputs: |
13 | | - prod_release: |
14 | | - description: 'Do you want to release to production?' |
15 | | - required: true |
16 | | - default: false |
17 | | - type: boolean |
18 | | - |
19 | | -jobs: |
20 | | - build_and_deploy_job: |
21 | | - if: ${{ inputs.prod_release }} || (github.event_name == 'pull_request' && github.event.action != 'closed') |
22 | | - runs-on: ubuntu-latest |
23 | | - env: |
24 | | - DOTNET_VERSION: "net10.0" |
25 | | - DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
26 | | - PROJECT: "BlazorBootstrap.Demo.WebAssembly/BlazorBootstrap.Demo.WebAssembly.csproj" |
27 | | - BUILD_CONFIG: "Release" |
28 | | - |
29 | | - name: Build and Deploy Job |
30 | | - steps: |
31 | | - - uses: actions/checkout@v4 |
32 | | - with: |
33 | | - submodules: true |
34 | | - lfs: false |
35 | | - |
36 | | - # Setup .NET 10.0 |
37 | | - - name: Setup .NET 10.0 |
38 | | - uses: actions/setup-dotnet@v4 |
39 | | - with: |
40 | | - dotnet-version: '10.0.x' |
41 | | - |
42 | | - # .NET Restore |
43 | | - - name: .NET Restore |
44 | | - run: dotnet restore ${{ env.PROJECT }} |
45 | | - |
46 | | - # .NET Build |
47 | | - - name: .NET Build |
48 | | - run: dotnet build ${{ env.PROJECT }} -c ${{ env.BUILD_CONFIG }} -f ${{ env.DOTNET_VERSION }} --no-restore |
49 | | - |
50 | | - # .NET Publish |
51 | | - - name: .NET Publish |
52 | | - run: dotnet publish ${{ env.PROJECT }} -c ${{ env.BUILD_CONFIG }} -o publish -f ${{ env.DOTNET_VERSION }} --no-build |
53 | | - |
54 | | - # Azure Static Web App Deployment Action |
55 | | - - name: Build And Deploy Blazor WASM App |
56 | | - id: swa |
57 | | - uses: azure/static-web-apps-deploy@v1 |
58 | | - with: |
59 | | - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }} |
60 | | - repo_token: ${{ secrets.GITHUB_TOKEN }} |
61 | | - action: "upload" |
62 | | - app_location: "publish/wwwroot" |
63 | | - api_location: "" |
64 | | - output_location: "publish/wwwroot" |
65 | | - skip_api_build: true |
66 | | - skip_app_build: true |
67 | | - |
68 | | - close_pull_request_job: |
69 | | - if: github.event_name == 'pull_request' && github.event.action == 'closed' |
70 | | - runs-on: ubuntu-latest |
71 | | - name: Close Pull Request Job |
72 | | - steps: |
73 | | - - name: Close Pull Request |
74 | | - id: closepullrequest |
75 | | - uses: azure/static-web-apps-deploy@v1 |
76 | | - with: |
77 | | - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }} |
78 | | - action: "close" |
| 1 | +name: StaticWebApp (Blazor WebAssembly) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + types: [opened, synchronize, reopened, closed] |
| 9 | + branches: |
| 10 | + - main |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + prod_release: |
| 14 | + description: 'Do you want to release to production?' |
| 15 | + required: true |
| 16 | + default: false |
| 17 | + type: boolean |
| 18 | + |
| 19 | +jobs: |
| 20 | + build_and_deploy_job: |
| 21 | + if: ${{ inputs.prod_release }} || (github.event_name == 'pull_request' && github.event.action != 'closed') |
| 22 | + runs-on: ubuntu-latest |
| 23 | + env: |
| 24 | + DOTNET_VERSION: "net10.0" |
| 25 | + DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
| 26 | + PROJECT: "BlazorBootstrap.Demo.WebAssembly/BlazorBootstrap.Demo.WebAssembly.csproj" |
| 27 | + BUILD_CONFIG: "Release" |
| 28 | + |
| 29 | + name: Build and Deploy Job |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + submodules: true |
| 34 | + lfs: false |
| 35 | + |
| 36 | + # Setup .NET 10.0 |
| 37 | + - name: Setup .NET 10.0 |
| 38 | + uses: actions/setup-dotnet@v4 |
| 39 | + with: |
| 40 | + dotnet-version: '10.0.x' |
| 41 | + |
| 42 | + # .NET Restore |
| 43 | + - name: .NET Restore |
| 44 | + run: dotnet restore ${{ env.PROJECT }} |
| 45 | + |
| 46 | + # .NET Build |
| 47 | + - name: .NET Build |
| 48 | + run: dotnet build ${{ env.PROJECT }} -c ${{ env.BUILD_CONFIG }} -f ${{ env.DOTNET_VERSION }} --no-restore |
| 49 | + |
| 50 | + # .NET Publish |
| 51 | + - name: .NET Publish |
| 52 | + run: dotnet publish ${{ env.PROJECT }} -c ${{ env.BUILD_CONFIG }} -o publish -f ${{ env.DOTNET_VERSION }} --no-build |
| 53 | + |
| 54 | + # Azure Static Web App Deployment Action |
| 55 | + - name: Build And Deploy Blazor WASM App |
| 56 | + id: swa |
| 57 | + uses: azure/static-web-apps-deploy@v1 |
| 58 | + with: |
| 59 | + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }} |
| 60 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + action: "upload" |
| 62 | + app_location: "publish/wwwroot" |
| 63 | + api_location: "" |
| 64 | + output_location: "publish/wwwroot" |
| 65 | + skip_api_build: true |
| 66 | + skip_app_build: true |
| 67 | + |
| 68 | + close_pull_request_job: |
| 69 | + if: github.event_name == 'pull_request' && github.event.action == 'closed' |
| 70 | + runs-on: ubuntu-latest |
| 71 | + name: Close Pull Request Job |
| 72 | + steps: |
| 73 | + - name: Close Pull Request |
| 74 | + id: closepullrequest |
| 75 | + uses: azure/static-web-apps-deploy@v1 |
| 76 | + with: |
| 77 | + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }} |
| 78 | + action: "close" |
0 commit comments