Skip to content

Update GitHub Actions workflow for Blazor deployment #2

Update GitHub Actions workflow for Blazor deployment

Update GitHub Actions workflow for Blazor deployment #2

Workflow file for this run

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: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x' # ggf. auf deine Version anpassen (8.0.x / 9.0.x)
- name: Publish
run: dotnet publish HelloWorldBlazor/HelloWorldBlazor.csproj -c Release -o release --nologo
- name: Fix base href for project page
run: sed -i 's|<base href="/" />|<base href="/BauMat-Navigator/" />|g' release/wwwroot/index.html
- name: Add .nojekyll
run: touch release/wwwroot/.nojekyll
- name: Copy index.html to 404.html (SPA routing fallback)
run: cp release/wwwroot/index.html release/wwwroot/404.html
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: release/wwwroot
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4