Skip to content

Build Blazor

Build Blazor #90

Workflow file for this run

name: Build Blazor
on:
push:
branches: [ "master" ]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.x'
- name: Install WASM workload
run: dotnet workload install wasm-tools
- name: Restore workloads
run: dotnet workload restore
- name: Restore dependencies
run: dotnet restore
- name: Build and Publish
run: dotnet publish LaunchApp/LaunchApp.csproj -c Release -o ${{ runner.temp }}/published_app --no-self-contained /p:PublishTrimmed=false
- name: Setup SPA routing
run: |
cp ${{ runner.temp }}/published_app/wwwroot/index.html ${{ runner.temp }}/published_app/wwwroot/404.html
sed -i 's/base href="\/"/base href="\/${{ github.event.repository.name }}\/"/' ${{ runner.temp }}/published_app/wwwroot/index.html
sed -i 's/<script src="_framework\/blazor.webassembly.js"><\/script>/<script src="_framework\/blazor.webassembly.js" autostart="false"><\/script>/' ${{ runner.temp }}/published_app/wwwroot/index.html
- name: Deploy to GitHub Pages
run: |
git checkout --orphan gh-pages
git clean -fdx
git rm -rf .
cp -r ${{ runner.temp }}/published_app/wwwroot/. .
touch .nojekyll
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "Deploy Blazor app to GitHub Pages"
git push -f origin gh-pages