Skip to content

Commit 384708b

Browse files
committed
Optimize .NET SDK setup and Azure SWA deployment
Replaced `actions/setup-dotnet` with a custom caching and installation process for the .NET 10 SDK to improve build efficiency. Added caching using `actions/cache` and a custom installation script. Updated environment variables and added a verification step for the .NET installation. Simplified Azure Static Web Apps deployment configuration by removing redundant comments and unused parameters. Updated `app_location` to point to `BlazorBootstrap.Demo.WebAssembly` and retained necessary build and output configurations. Cleaned up unused repository/build configuration examples for clarity.
1 parent 94b67dc commit 384708b

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

.github/workflows/azure-static-web-apps-calm-plant-04da70210.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,44 @@ jobs:
2121
submodules: true
2222
lfs: false
2323

24-
# 1. Setup .NET 10 SDK
25-
- name: Setup .NET
26-
uses: actions/setup-dotnet@v4
24+
- name: Cache .NET 10 SDK
25+
uses: actions/cache@v4
2726
with:
28-
dotnet-version: '10.0.x' # Specifies the use of .NET 10 SDK
27+
path: $HOME/.dotnet
28+
key: dotnet-10-${{ runner.os }}-${{ hashFiles('**/global.json') }}
29+
restore-keys: |
30+
dotnet-10-${{ runner.os }}-
31+
32+
- name: Install .NET 10 SDK
33+
shell: bash
34+
run: |
35+
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
36+
chmod +x dotnet-install.sh
37+
# install latest 10.x channel; replace --version <exact-version> if needed
38+
./dotnet-install.sh --channel 10.0 --install-dir $HOME/.dotnet
39+
echo "$HOME/.dotnet" >> $GITHUB_PATH
40+
echo "DOTNET_ROOT=$HOME/.dotnet" >> $GITHUB_ENV
41+
- name: Verify dotnet
42+
run: dotnet --info
43+
44+
# # 1. Setup .NET 10 SDK
45+
# - name: Setup .NET
46+
# uses: actions/setup-dotnet@v4
47+
# with:
48+
# dotnet-version: '10.0.x'
2949

3050
# 2. Azure Static Web App Deployment Action
31-
# This action automatically handles the dotnet restore, build, and publish steps
32-
# and deploys the output to SWA.
3351
- name: Build And Deploy Blazor WASM App
3452
id: swa
3553
uses: azure/static-web-apps-deploy@v1
3654
with:
37-
dotnet-version: '10.0.x' # Specifies the use of .NET 10 SDK
55+
dotnet-version: '10.0.x'
3856
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_PLANT_04DA70210 }}
39-
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
57+
repo_token: ${{ secrets.GITHUB_TOKEN }}
4058
action: "upload"
41-
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
42-
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
43-
#app_location: "Client" # App source code path
4459
app_location: "BlazorBootstrap.Demo.WebAssembly" # App source code path
45-
#api_location: "Api" # Api source code path - optional
4660
output_location: "wwwroot" # Built app content directory - optional
4761
app_build_command: 'dotnet publish --configuration Release --output build'
48-
###### End of Repository/Build Configurations ######
4962

5063
close_pull_request_job:
5164
if: github.event_name == 'pull_request' && github.event.action == 'closed'

0 commit comments

Comments
 (0)