Updates #61
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Blazor Sample | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'v*' | |
| paths: | |
| - 'samples/Sample.Blazor/**' | |
| - 'src/Shiny.Blazor.Controls*/**' | |
| # the Blazor packages build on these shared projects (camera effects/filters, barcode symbologies) — | |
| # without them a shared-only fix ships to NuGet but never redeploys the playground | |
| - 'src/Shiny.Controls.*.Shared/**' | |
| - 'Directory.Build.props' | |
| - 'Directory.Packages.props' | |
| - '.github/workflows/deploy-blazor-sample.yml' | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| env: | |
| BASE_HREF: /controls/ | |
| SAMPLE_CSPROJ: samples/Sample.Blazor/Sample.Blazor.csproj | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 # Nerdbank.GitVersioning needs full history | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: '10.0.x' | |
| # wasm-tools has to be named explicitly: `dotnet workload restore` installs nothing for a | |
| # Blazor WebAssembly project, and without the workload the SkiaSharp native relink is skipped | |
| # silently — the publish succeeds and every Office view then throws | |
| # "DllNotFoundException: libSkiaSharp" in the browser. The guard imported by Sample.Blazor.csproj | |
| # turns that back into a build failure, but the workload is what actually fixes it. | |
| - name: Restore workloads | |
| run: | | |
| dotnet workload install wasm-tools | |
| dotnet workload restore "${{ env.SAMPLE_CSPROJ }}" | |
| - name: Publish | |
| run: dotnet publish "${{ env.SAMPLE_CSPROJ }}" -c Release -o publish | |
| - name: Rewrite base href + add SPA fallback | |
| run: | | |
| sed -i -E 's|<base href="/" ?/>|<base href="${{ env.BASE_HREF }}" />|g' publish/wwwroot/index.html | |
| cp publish/wwwroot/index.html publish/wwwroot/404.html | |
| touch publish/wwwroot/.nojekyll | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: publish/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@v5 |