Skip to content

Fix: Add UTF-8 BOM and fix Blazor WASM deployment #36

Fix: Add UTF-8 BOM and fix Blazor WASM deployment

Fix: Add UTF-8 BOM and fix Blazor WASM deployment #36

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
tags:
- 'v*'
pull_request:
branches: [ main ]
workflow_dispatch:
env:
DOTNET_VERSION: '9.0.x'
jobs:
# Test job runs on all pushes and PRs
test:
runs-on: ubuntu-latest
name: Test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for Nerdbank.GitVersioning
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install Nerdbank.GitVersioning
run: dotnet tool install -g nbgv
- name: Get Version
id: nbgv
run: |
VERSION=$(nbgv get-version -v SimpleVersion)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "[INFO] Version: $VERSION"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
# Build and publish NuGet package on tag push
publish-nuget:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/v')
name: Publish to NuGet
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for Nerdbank.GitVersioning
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install Nerdbank.GitVersioning
run: dotnet tool install -g nbgv
- name: Get Version
id: nbgv
run: |
VERSION=$(nbgv get-version -v SimpleVersion)
FULL_VERSION=$(nbgv get-version -v SemVer2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "fullVersion=$FULL_VERSION" >> $GITHUB_OUTPUT
echo "[INFO] Version: $VERSION"
echo "[INFO] Full Version: $FULL_VERSION"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Pack
run: dotnet pack SchemaMagic/SchemaMagic.csproj --no-build --configuration Release --output ./nupkg
- name: Display Package Info
run: |
echo "[INFO] Generated Packages:"
ls -lh ./nupkg/
- name: Publish to NuGet
run: |
dotnet nuget push ./nupkg/*.nupkg \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.nbgv.outputs.version }}
body: |
## SchemaMagic ${{ steps.nbgv.outputs.version }}
### Installation
```bash
dotnet tool install -g SchemaMagic --version ${{ steps.nbgv.outputs.version }}
```
### Update Existing Installation
```bash
dotnet tool update -g SchemaMagic
```
### Links
- [NuGet Package](https://www.nuget.org/packages/SchemaMagic/${{ steps.nbgv.outputs.version }})
- [Web Application](https://panoramicdata.github.io/SchemaMagic)
- [Documentation](https://github.com/panoramicdata/SchemaMagic/blob/main/README.md)
draft: false
prerelease: false
# Deploy web application to GitHub Pages
deploy-web:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
name: Deploy Web to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for Nerdbank.GitVersioning
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install Nerdbank.GitVersioning
run: dotnet tool install -g nbgv
- name: Get Version
id: nbgv
run: |
VERSION=$(nbgv get-version -v SimpleVersion)
FULL_VERSION=$(nbgv get-version -v SemVer2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "fullVersion=$FULL_VERSION" >> $GITHUB_OUTPUT
echo "[INFO] Web App Version: $VERSION"
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Restore dependencies
run: dotnet restore SchemaMagic.Web/SchemaMagic.Web.csproj
- name: Publish
run: dotnet publish SchemaMagic.Web/SchemaMagic.Web.csproj --configuration Release --output publish/
- name: List published files
run: |
echo "[INFO] Listing published files..."
ls -la publish/
echo "[INFO] Checking for wwwroot..."
if [ -d "publish/wwwroot" ]; then
echo "[INFO] wwwroot exists, listing contents..."
ls -la publish/wwwroot/ | head -20
echo "[INFO] Checking for _framework..."
ls -la publish/wwwroot/_framework/ | head -10 || echo "[INFO] No _framework in wwwroot"
else
echo "[INFO] No wwwroot directory found"
echo "[INFO] Checking for _framework in publish root..."
ls -la publish/_framework/ | head -10 || echo "[INFO] No _framework in publish root"
fi
echo "[INFO] Searching for index.html..."
find publish/ -name "index.html" -type f
- name: Configure for GitHub Pages
run: |
echo "[INFO] Configuring for GitHub Pages with custom domain (schema.magicsuite.net)..."
# Determine the correct directory structure
if [ -d "publish/wwwroot" ]; then
echo "[INFO] Found publish/wwwroot/ - using it as deployment root"
DEPLOY_DIR="publish/wwwroot"
else
echo "[INFO] No wwwroot subdirectory - using publish/ as deployment root"
DEPLOY_DIR="publish"
fi