Update GitHub Actions workflow for deployment #22
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
| # .github/workflows/deploy-gh-pages.yml | |
| name: Deploy Blazor WASM to GitHub Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.x' | |
| # Publishes the project. The output will be in a new 'release' folder at the root. | |
| - name: Publish .NET project | |
| run: dotnet publish URLScan/URLScan.csproj -c Release -o release --nologo | |
| # Adjusts the base href in the generated index.html inside the 'release' folder. | |
| - name: Adjust base href for GitHub Pages | |
| run: sed -i 's/<base href="\/" \/>/<base href="\/URLValidator\/" \/>/g' release/wwwroot/index.html | |
| # Adds a .nojekyll file to the deployment root to disable Jekyll processing. | |
| - name: Add .nojekyll file | |
| run: touch release/wwwroot/.nojekyll | |
| # Deploys the contents of the 'release/wwwroot' folder to the gh-pages branch. | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./release/wwwroot | |
| - name: Super-Linter | |
| uses: super-linter/super-linter@v7 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |