-
Notifications
You must be signed in to change notification settings - Fork 6
49 lines (42 loc) · 1.97 KB
/
dotnet.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: .NET
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore ./src/GTour/GTour.csproj
- name: Build
run: dotnet build ./src/GTour/GTour.csproj --no-restore --configuration Release
- name: Push Nuget Package with dotnet
run: dotnet nuget push ./src/GTour/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Build Demo Site
run: dotnet publish ./src/STGTour.DemoWASM/STGTour.DemoWASM.csproj -c Release -o Prerender/output --nologo
# Use NodeJS react-snap utitility to prerender static website
- name: Pre-render Blazor client
working-directory: Prerender
run: npx react-snap
# change base tag in all html files to include subfolder
- name: Remove PreRender Script Tags
working-directory: Prerender/output/wwwroot
run: |
find . -name "*.html" | while read htmlFile; do
sed -i 's/<base href="\/"/<base href="\/STGTour\/"/g' $htmlFile
sed -i 's/<script type="text\/javascript">var Module; window.__wasmmodulecallback__(); delete window.__wasmmodulecallback__;<\/script><script src="_framework\/dotnet.5.0.16.js" defer="" integrity="sha256-91Lkmf2zogMIsa4MlLoZB\/H3WzhSaONSbWRM79ojtfA=" crossorigin="anonymous"><\/script>//g' $htmlFile
done
# 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 Prerender/output/wwwroot/.nojekyll
- name: Commit wwwroot to GitHub Pages
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: Prerender/output/wwwroot