Fix: Remove emoji encoding issues in workflow and auto-trigger discov… #32
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: 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) | |
| echo "version=$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 dist/ | |
| - name: List published files | |
| run: | | |
| echo "[INFO] Listing published files..." | |
| ls -la dist/ | |
| echo "[INFO] Checking for wwwroot..." | |
| if [ -d "dist/wwwroot" ]; then | |
| echo "[INFO] wwwroot exists, listing contents..." | |
| ls -la dist/wwwroot/ | |
| echo "[INFO] Looking for index.html in wwwroot..." | |
| find dist/wwwroot -name "index.html" -type f || echo "[INFO] No index.html found in wwwroot" | |
| else | |
| echo "[INFO] No wwwroot directory found" | |
| fi | |
| echo "[INFO] Searching for ALL index.html files in dist/..." | |
| find dist/ -name "index.html" -type f || echo "[INFO] No index.html found anywhere in dist/" | |
| echo "[INFO] Listing ALL files in dist/ recursively (first 50)..." | |
| find dist/ -type f | head -50 | |
| - name: Fix base path for GitHub Pages | |
| run: | | |
| echo "[INFO] Configuring for GitHub Pages..." | |
| # Check if index.html is in wwwroot subdirectory | |
| if [ -f "dist/wwwroot/index.html" ]; then | |
| echo "[INFO] Found index.html in dist/wwwroot/" | |
| sed -i 's|<base href="/" />|<base href="/SchemaMagic/" />|g' dist/wwwroot/index.html | |
| touch dist/wwwroot/.nojekyll | |
| cp dist/wwwroot/index.html dist/wwwroot/404.html | |
| echo "${{ steps.nbgv.outputs.version }}" > dist/wwwroot/version.txt | |
| elif [ -f "dist/index.html" ]; then | |
| echo "[INFO] Found index.html in dist/" | |
| sed -i 's|<base href="/" />|<base href="/SchemaMagic/" />|g' dist/index.html | |
| touch dist/.nojekyll | |
| cp dist/index.html dist/404.html | |
| echo "${{ steps.nbgv.outputs.version }}" > dist/version.txt | |
| else | |
| echo "[ERROR] Could not find index.html in dist/ or dist/wwwroot/" | |
| exit 1 | |
| fi | |
| echo "[SUCCESS] GitHub Pages configuration complete" | |
| echo "[INFO] Version: ${{ steps.nbgv.outputs.version }}" | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dist/wwwroot/ | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Deployment Summary | |
| run: | | |
| echo "### Deployment Successful!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** ${{ steps.nbgv.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**URL:** ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Deployed:** $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY |