-
Notifications
You must be signed in to change notification settings - Fork 9
49 lines (40 loc) · 1.76 KB
/
github-page.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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