This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
Feature/rename #54
Workflow file for this run
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: github pages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- uses: actions/checkout@v2 | |
# Install .NET SDK | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.0.x | |
# 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 samples/PatrickJahr.Blazor.Sample/PatrickJahr.Blazor.Sample.csproj -c:Release -p:GHPages=true -o dist/Web --nologo | |
# changes the base-tag in index.html from '/' to 'PatrickJahr.Blazor' to match GitHub Pages repository subdirectory | |
- name: Rewrite base href | |
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | |
with: | |
html_path: dist/Web/wwwroot/index.html | |
base_href: /PatrickJahr.Blazor/ | |
# 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/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: dist/Web/wwwroot |