Update deploy-blazor-wasm.yml #5
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: Deploy Blazor WASM to GitHub Page | |
env: | |
PUBLISH_DIR: bin/Release/net8.0/publish/wwwroot | |
# Controls when the action will run | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./MyLife.Blazor.Wasm | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.204' | |
- name: Publish application | |
run: dotnet publish -c Release | |
# base href url value should be changed so that resources like CSS and scripts can load properly. | |
- name: Rewrite base href | |
if: success() | |
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | |
with: | |
html_path: ${{ env.PUBLISH_DIR }}/index.html | |
base_href: BASE_URL or REPOSITORY_NAME | |
# 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 ${{ env.PUBLISH_DIR }}/.nojekyll | |
- name: Commit to GitHub pages Repo | |
if: success() | |
uses: crazy-max/ghaction-github-pages@v1.5.1 | |
with: | |
target_branch: gh-pages | |
build_dir: ${{ env.PUBLISH_DIR }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |