Skip to content

Bump Microsoft.AspNetCore.Components.WebAssembly.DevServer from 10.0.1 to 10.0.2 #105

Bump Microsoft.AspNetCore.Components.WebAssembly.DevServer from 10.0.1 to 10.0.2

Bump Microsoft.AspNetCore.Components.WebAssembly.DevServer from 10.0.1 to 10.0.2 #105

name: Azure Static Web Apps CI/CD
permissions:
contents: read
pull-requests: write
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.action != 'closed'
runs-on: ubuntu-latest
name: Build and Deploy Job
env:
STORYBLOK_API_KEY_PUBLIC_VAL: ${{ secrets.STORYBLOK_API_KEY_PUBLIC }}
STORYBLOK_API_KEY_PREVIEW_VAL: ${{ secrets.STORYBLOK_API_KEY_PREVIEW }}
APPSETTINGS_PATH: Client/wwwroot/appsettings.json
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Setup .NET 10
uses: actions/setup-dotnet@v3
with:
dotnet-version: '10.0.x'
- name: Inject Secrets into appsettings.json
run: |
echo "Injecting secrets into ${{ env.APPSETTINGS_PATH }}..."
if [ ! -f "${{ env.APPSETTINGS_PATH }}" ]; then
echo "Error: appsettings.json not found at ${{ env.APPSETTINGS_PATH }}"
exit 1
fi
sed -i "s#__STORYBLOK_API_KEY_PUBLIC__#${STORYBLOK_API_KEY_PUBLIC_VAL}#g" "${{ env.APPSETTINGS_PATH }}"
sed -i "s#__STORYBLOK_API_KEY_PREVIEW__#${STORYBLOK_API_KEY_PREVIEW_VAL}#g" "${{ env.APPSETTINGS_PATH }}"
echo "Secrets injected."
- name: Install wasm-tools workload
run: dotnet workload install wasm-tools
- name: Restore and publish Blazor WASM
working-directory: Client
run: |
dotnet restore
dotnet publish -c Release -o ./bin/Release/net10/publish
- name: Verify publish output
working-directory: Client/bin/Release/net10/publish/wwwroot
run: |
echo "Listing published wwwroot files:"
ls -la
echo "Check index.html exists:"
test -f index.html && echo "index.html FOUND" || (echo "index.html MISSING" && exit 1)
- name: Build and Deploy to Azure Static Web Apps
id: builddeploy
uses: Azure/static-web-apps-deploy@latest
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GRAY_TREE_0C2E88D03 }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "Client/bin/Release/net10/publish/wwwroot"
api_location: ""
output_location: ""
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: Placeholder for PR Cleanup Logic
run: echo "PR closed. Azure SWA might automatically handle environment cleanup."