O| and O< notation working #24
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 SchemaMagic Web to GitHub Pages | |
| on: | |
| # Manual deployment trigger | |
| workflow_dispatch: | |
| # Deploy when web files change (bypasses CI/CD for quick updates) | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'SchemaMagic.Web/**' | |
| - 'SchemaMagic.Core/**' | |
| - '.github/workflows/deploy-web.yml' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| name: Deploy Web Application | |
| 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: '9.0.x' | |
| - 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 "Deploying SchemaMagic Web v$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 "Listing published files for debugging..." | |
| echo "Contents of publish/:" | |
| ls -la publish/ | |
| echo "" | |
| echo "Contents of publish/wwwroot/:" | |
| ls -la publish/wwwroot/ || echo "No wwwroot directory" | |
| echo "" | |
| echo "Searching for ALL index.html files:" | |
| find publish/ -name "index.html" -type f || echo "No index.html found" | |
| echo "" | |
| echo "Searching for _framework directory:" | |
| find publish/ -type d -name "_framework" || echo "No _framework directory found" | |
| - name: Configure for GitHub Pages | |
| run: | | |
| echo "Configuring for GitHub Pages..." | |
| # Determine the correct directory structure | |
| if [ -d "publish/wwwroot" ]; then | |
| echo "Found publish/wwwroot/ - using it as deployment root" | |
| DEPLOY_DIR="publish/wwwroot" | |
| else | |
| echo "No wwwroot subdirectory - using publish/ as deployment root" | |
| DEPLOY_DIR="publish" | |
| fi | |
| # Add .nojekyll file to prevent GitHub Pages from processing as Jekyll site | |
| touch ${DEPLOY_DIR}/.nojekyll | |
| # Copy 404.html for SPA routing | |
| cp ${DEPLOY_DIR}/index.html ${DEPLOY_DIR}/404.html | |
| # Ensure CNAME file is present for custom domain | |
| if [ -f "SchemaMagic.Web/wwwroot/CNAME" ]; then | |
| cp SchemaMagic.Web/wwwroot/CNAME ${DEPLOY_DIR}/CNAME | |
| echo "CNAME file copied: $(cat ${DEPLOY_DIR}/CNAME)" | |
| else | |
| echo "Warning: CNAME file not found" | |
| fi | |
| # Add version info file | |
| echo "${{ steps.nbgv.outputs.fullVersion }}" > ${DEPLOY_DIR}/version.txt | |
| date -u +'%Y-%m-%d %H:%M:%S UTC' > ${DEPLOY_DIR}/deployed.txt | |
| echo "Configuration complete" | |
| echo "Version: ${{ steps.nbgv.outputs.version }}" | |
| echo "Build size: $(du -sh ${DEPLOY_DIR} | cut -f1)" | |
| echo "Custom domain: schema.magicsuite.net" | |
| echo "Deployment directory: ${DEPLOY_DIR}" | |
| # Save deployment directory for next step | |
| echo "DEPLOY_DIR=${DEPLOY_DIR}" >> $GITHUB_ENV | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ${{ env.DEPLOY_DIR }} | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Deployment Summary | |
| run: | | |
| echo "### SchemaMagic Web Deployed!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Version | ${{ steps.nbgv.outputs.version }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Full Version | ${{ steps.nbgv.outputs.fullVersion }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Custom Domain | https://schema.magicsuite.net |" >> $GITHUB_STEP_SUMMARY | |
| echo "| GitHub Pages | ${{ steps.deployment.outputs.page_url }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Deployed | $(date -u +'%Y-%m-%d %H:%M:%S UTC') |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Branch | ${{ github.ref_name }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Try it now:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Custom Domain**: [schema.magicsuite.net](https://schema.magicsuite.net)" >> $GITHUB_STEP_SUMMARY | |
| echo "- **GitHub Pages**: [${{ steps.deployment.outputs.page_url }}](${{ steps.deployment.outputs.page_url }})" >> $GITHUB_STEP_SUMMARY |