name: Deploy Blazor WASM to GitHub Pages
on:
push:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore ./RackPeek.Web.Viewer/RackPeek.Web.Viewer.csproj
- name: Publish Blazor WASM
run: dotnet publish ./RackPeek.Web.Viewer/RackPeek.Web.Viewer.csproj -c Release -o publish
# patch base href FIRST
- name: Fix base href for Pages
run: |
sed -i 's|||g' publish/wwwroot/index.html
# THEN copy to 404.html
- name: SPA fallback
run: cp publish/wwwroot/index.html publish/wwwroot/404.html
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: publish/wwwroot
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4