Last active
February 13, 2024 23:15
-
-
Save Carl-Hugo/721b848942083dc7739141a917a30653 to your computer and use it in GitHub Desktop.
GitHub Action: Deploy Blazor WASM to GitHub Pages
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 WASM to GitHub Pages | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy-to-github-pages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.x | |
include-prerelease: true | |
- name: Publish .NET Core Project | |
run: dotnet publish src/YOUR_PROJECT_NAME/YOUR_PROJECT_NAME.csproj -c Release -o release --nologo | |
- name: copy index.html to 404.html | |
run: cp release/wwwroot/index.html release/wwwroot/404.html | |
- name: Add .nojekyll file | |
run: touch release/wwwroot/.nojekyll | |
- name: Commit wwwroot to GitHub Pages | |
uses: JamesIves/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: release/wwwroot | |
# Based on https://swimburger.net/blog/dotnet/how-to-deploy-aspnet-blazor-webassembly-to-github-pages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment