1- name : Static WebApp (Blazor WebAssembly)
1+ name : StaticWebApp (Blazor WebAssembly)
22
33on :
44 push :
1818
1919jobs :
2020 build_and_deploy_job :
21- # Run when:
22- # - workflow_dispatch AND prod_release == true
23- # - OR pull_request (except when closed)
24- if : >
25- (github.event_name == 'workflow_dispatch' && github.event.inputs.prod_release == 'true') ||
26- (github.event_name == 'pull_request' && github.event.action != 'closed')
21+ if : ${{ inputs.prod_release }} || (github.event_name == 'pull_request' && github.event.action != 'closed')
2722 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+
2829 name : Build and Deploy Job
2930 steps :
30- - uses : actions/checkout@v5
31+ - uses : actions/checkout@v4
3132 with :
3233 submodules : true
34+ lfs : false
3335
34- - name : Setup .NET SDK
35- uses : actions/setup-dotnet@v5
36+ # Setup .NET 10.0
37+ - name : Setup .NET 10.0
38+ uses : actions/setup-dotnet@v4
3639 with :
3740 dotnet-version : ' 10.0.x'
38-
39- - name : Install WASM workload
40- run : dotnet workload install wasm-tools --skip-manifest-update
41-
42- - name : Restore
43- run : dotnet restore
44-
45- - name : Publish app (produce static assets)
46- run : dotnet publish BlazorBootstrap.Demo.WebAssembly -c Release -o build
47-
48- - name : Show published files (debug)
49- run : |
50- echo "repo root tree (top-level):"
51- ls -la .
52- echo "build folder tree:"
53- ls -la build || true
54- echo "build/wwwroot tree:"
55- ls -la build/wwwroot || true
56- echo "index.html exists?"
57- if [ -f build/wwwroot/index.html ]; then echo "FOUND"; else echo "MISSING"; fi
58-
59- - name : Build And Deploy (upload artifacts; skip Oryx build)
60- id : builddeploy
61- uses : Azure/static-web-apps-deploy@v1
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 output -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
6258 with :
63- azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GRAY_WAVE_0E4848710 }}
59+ azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }}
6460 repo_token : ${{ secrets.GITHUB_TOKEN }}
6561 action : " upload"
66- app_location : " ." # repository root
67- skip_app_build : true # we already produced the build on runner
68- app_artifact_location : " build/wwwroot" # <-- IMPORTANT: point to the published static files
62+ app_location : " output/wwwroot"
63+ api_location : " "
64+ output_location : " output/wwwroot"
65+ skip_api_build : true
66+ skip_app_build : true
6967
7068 close_pull_request_job :
7169 if : github.event_name == 'pull_request' && github.event.action == 'closed'
7472 steps :
7573 - name : Close Pull Request
7674 id : closepullrequest
77- uses : Azure /static-web-apps-deploy@v1
75+ uses : azure /static-web-apps-deploy@v1
7876 with :
79- azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GRAY_WAVE_0E4848710 }}
80- action : " close"
77+ azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }}
78+ action : " close"
0 commit comments