Merge pull request #19 from neozhu/net9rc1 #99
This file contains 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: build and deploy GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy-to-github-pages: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- uses: actions/checkout@v4 | |
# Install .NET Core SDK | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
dotnet-quality: 'preview' | |
# Install dotnet wasm buildtools workload | |
- name: Install .NET WASM Build Tools | |
run: dotnet workload install wasm-tools | |
# Publishes Blazor project to the release-folder | |
- name: Publish .NET Core Project | |
run: dotnet publish ./src/BlazorPocket.WebAssembly/BlazorPocket.WebAssembly.csproj -c:Release -p:GHPages=true -o dist/Web --nologo | |
# changes the base-tag in index.html from '/' to 'https://neozhu.github.io/BlazorPocketApp/' to match GitHub Pages repository subdirectory | |
- name: Change base-tag in index.html from / to https://neozhu.github.io/BlazorPocketApp/ | |
run: sed -i 's|<base href="/" />|<base href="https://neozhu.github.io/BlazorPocketApp/" />|g' dist/Web/wwwroot/index.html | |
# copy index.html to 404.html to serve the same file when a file is not found | |
# - name: copy index.html to 404.html | |
# run: cp dist/Web/wwwroot/index.html dist/Web/wwwroot/404.html | |
# add .nojekyll file to tell GitHub pages to not treat this as a Jekyll project. (Allow files and folders starting with an underscore) | |
- name: Add .nojekyll file | |
run: touch dist/Web/wwwroot/.nojekyll | |
- name: Commit wwwroot to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
BRANCH: gh-pages | |
FOLDER: dist/Web/wwwroot |