1
+ name : Deploy to GitHub Pages
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ workflow_dispatch :
7
+
8
+ jobs :
9
+ deploy :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - uses : actions/checkout@v3
13
+
14
+ - name : Setup .NET
15
+ uses : actions/setup-dotnet@v3
16
+ with :
17
+ dotnet-version : 8.0.x
18
+
19
+ - name : Restore dependencies
20
+ run : dotnet restore LagerClient.Blazor/LagerClient.Blazor.sln
21
+
22
+ - name : Build
23
+ run : dotnet build LagerClient.Blazor/LagerClient.Blazor.sln --no-restore --configuration Release
24
+
25
+ - name : Publish
26
+ run : dotnet publish LagerClient.Blazor/Client/Client.csproj -c Release -o release --nologo
27
+
28
+ # Füge .nojekyll-Datei hinzu, um Jekyll-Verarbeitung zu deaktivieren
29
+ - name : Add .nojekyll file
30
+ run : touch release/wwwroot/.nojekyll
31
+
32
+ # Ändere die base-href für GitHub Pages
33
+ - name : Change base-href in index.html
34
+ run : sed -i 's/<base href="\/" \/>/<base href="\/LagerClientBlazor\/" \/>/g' release/wwwroot/index.html
35
+
36
+ # Kopiere index.html zu 404.html, damit Routing funktioniert
37
+ - name : Copy index.html to 404.html
38
+ run : cp release/wwwroot/index.html release/wwwroot/404.html
39
+
40
+ # Kopiere die generierten Dateien in den docs-Ordner
41
+ - name : Prepare docs directory
42
+ run : |
43
+ rm -rf docs
44
+ mkdir -p docs
45
+ cp -r release/wwwroot/* docs/
46
+
47
+ # Commit und Push der Änderungen
48
+ - name : Commit and push changes
49
+ run : |
50
+ git config --local user.email "action@github.com"
51
+ git config --local user.name "GitHub Action"
52
+ git add docs
53
+ git commit -m "Update GitHub Pages" || echo "No changes to commit"
54
+ git push
0 commit comments