Skip to content

Commit 6317c17

Browse files
authored
GitHub Pages (#29)
1 parent 2cf0243 commit 6317c17

File tree

14 files changed

+136
-44
lines changed

14 files changed

+136
-44
lines changed

.github/workflows/build-all.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,54 @@ jobs:
1313

1414
steps:
1515
- name: Checkout the repository
16-
uses: actions/checkout@v1
16+
uses: actions/checkout@v2
17+
with:
18+
persist-credentials: false
19+
20+
- name: Fetch all branches (used by GitVersion)
21+
run: git fetch --prune --unshallow
1722

1823
- name: Setup .NET Core
1924
uses: actions/setup-dotnet@v1
2025
with:
2126
dotnet-version: 3.1.200
2227

2328
- name: Restore library
24-
run: dotnet restore BlazorLazyLoading.sln
29+
run: dotnet restore BlazorLazyLoading.sln -p:BLLUseLocalNugetPackages=true
2530

2631
- name: Build library
27-
run: dotnet build -c Release BlazorLazyLoading.sln
32+
run: dotnet build BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true
2833

2934
- name: Test library
30-
run: dotnet test -c Release BlazorLazyLoading.sln
35+
run: dotnet test BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true
3136

3237
- name: Pack library
33-
run: dotnet pack -c Release BlazorLazyLoading.sln
34-
35-
- name: Upload artifacts
36-
uses: actions/upload-artifact@v1
37-
with:
38-
name: output
39-
path: output
38+
run: dotnet pack BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true
4039

4140
- name: Restore demo
42-
run: dotnet restore -p:BLLUseLocalNugetPackages=true demo/Demo.sln
41+
run: dotnet restore demo/Demo.sln -p:BLLUseLocalNugetPackages=true
4342

4443
- name: Build demo
45-
run: dotnet build -c Release -p:BLLUseLocalNugetPackages=true demo/Demo.sln
44+
run: dotnet build demo/Demo.sln -c Release -p:BLLUseLocalNugetPackages=true
45+
46+
- name: Publish demo
47+
run: dotnet publish demo/ServerHost/ServerHost.csproj -c Release -p:BLLUseLocalNugetPackages=true -o output/demo
4648

4749
- name: Test demo
48-
run: dotnet test -c Release demo/Demo.sln
50+
run: dotnet test demo/Demo.sln -c Release
51+
52+
- name: Prepare for Github Pages deployment
53+
run: find output/demo -name "*.gitignore" -type f -print0 | xargs -0 /bin/rm -f
54+
55+
- name: Deploy demo to Github Pages
56+
uses: jamesives/[email protected]
57+
with:
58+
FOLDER: output/demo/wwwroot
59+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
60+
BRANCH: gh-pages
61+
62+
- name: Upload artifacts
63+
uses: actions/upload-artifact@v1
64+
with:
65+
name: output
66+
path: output

.github/workflows/nuget-publish.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,54 @@ jobs:
2020

2121
steps:
2222
- name: Checkout the repository
23-
uses: actions/checkout@v1
23+
uses: actions/checkout@v2
24+
with:
25+
persist-credentials: false
26+
27+
- name: Fetch all branches (used by GitVersion)
28+
run: git fetch --prune --unshallow
2429

2530
- name: Setup .NET Core
2631
uses: actions/setup-dotnet@v1
2732
with:
2833
dotnet-version: 3.1.200
2934

3035
- name: Restore library
31-
run: dotnet restore BlazorLazyLoading.sln
36+
run: dotnet restore BlazorLazyLoading.sln -p:BLLUseLocalNugetPackages=true
3237

3338
- name: Build library
34-
run: dotnet build -c Release BlazorLazyLoading.sln
35-
39+
run: dotnet build BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true
40+
3641
- name: Test library
37-
run: dotnet test -c Release BlazorLazyLoading.sln
42+
run: dotnet test BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true
3843

3944
- name: Pack library
40-
run: dotnet pack -c Release BlazorLazyLoading.sln
45+
run: dotnet pack BlazorLazyLoading.sln -c Release -p:BLLUseLocalNugetPackages=true
4146

4247
- name: Restore demo
43-
run: dotnet restore -p:BLLUseLocalNugetPackages=true demo/Demo.sln
48+
run: dotnet restore demo/Demo.sln -p:BLLUseLocalNugetPackages=true
4449

4550
- name: Build demo
46-
run: dotnet build -c Release -p:BLLUseLocalNugetPackages=true demo/Demo.sln
51+
run: dotnet build demo/Demo.sln -c Release -p:BLLUseLocalNugetPackages=true
52+
53+
- name: Publish demo
54+
run: dotnet publish demo/ServerHost/ServerHost.csproj -c Release -p:BLLUseLocalNugetPackages=true -o output/demo
4755

4856
- name: Test demo
49-
run: dotnet test -c Release demo/Demo.sln
57+
run: dotnet test demo/Demo.sln -c Release
5058

5159
- name: Push package to NuGet
52-
run: dotnet nuget push output/**/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
60+
run: dotnet nuget push output/nuget/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
61+
62+
- name: Prepare for Github Pages deployment
63+
run: find output/demo -name "*.gitignore" -type f -print0 | xargs -0 /bin/rm -f
64+
65+
- name: Deploy demo to Github Pages
66+
uses: jamesives/[email protected]
67+
with:
68+
FOLDER: output/demo/wwwroot
69+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
70+
BRANCH: gh-pages
5371

5472
- name: Upload artifacts
5573
uses: actions/upload-artifact@v1

BlazorLazyLoading.sln

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ EndProject
2525
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{AE8E1C15-B862-43CB-AC0E-94B83BE0A250}"
2626
ProjectSection(SolutionItems) = preProject
2727
.gitignore = .gitignore
28+
Directory.Build.props = Directory.Build.props
29+
Directory.Build.targets = Directory.Build.targets
2830
GitVersion.yml = GitVersion.yml
31+
nuget.config = nuget.config
2932
EndProjectSection
3033
EndProject
3134
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorLazyLoading.Server", "nuget\BlazorLazyLoading.Server\BlazorLazyLoading.Server.csproj", "{B14D3B51-3320-46B7-8815-0FF3F18DBCB3}"
@@ -183,29 +186,17 @@ Global
183186
{10AB33A5-80F4-4D02-9DBE-0484C3BB6954}.Release|x86.ActiveCfg = Release|Any CPU
184187
{10AB33A5-80F4-4D02-9DBE-0484C3BB6954}.Release|x86.Build.0 = Release|Any CPU
185188
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
186-
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Debug|Any CPU.Build.0 = Debug|Any CPU
187189
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Debug|x64.ActiveCfg = Debug|Any CPU
188-
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Debug|x64.Build.0 = Debug|Any CPU
189190
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Debug|x86.ActiveCfg = Debug|Any CPU
190-
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Debug|x86.Build.0 = Debug|Any CPU
191191
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Release|Any CPU.ActiveCfg = Release|Any CPU
192-
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Release|Any CPU.Build.0 = Release|Any CPU
193192
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Release|x64.ActiveCfg = Release|Any CPU
194-
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Release|x64.Build.0 = Release|Any CPU
195193
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Release|x86.ActiveCfg = Release|Any CPU
196-
{2EF3EB2F-0E00-4554-8EDC-7CEEE5C7B899}.Release|x86.Build.0 = Release|Any CPU
197194
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
198-
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Debug|Any CPU.Build.0 = Debug|Any CPU
199195
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Debug|x64.ActiveCfg = Debug|Any CPU
200-
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Debug|x64.Build.0 = Debug|Any CPU
201196
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Debug|x86.ActiveCfg = Debug|Any CPU
202-
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Debug|x86.Build.0 = Debug|Any CPU
203197
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Release|Any CPU.ActiveCfg = Release|Any CPU
204-
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Release|Any CPU.Build.0 = Release|Any CPU
205198
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Release|x64.ActiveCfg = Release|Any CPU
206-
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Release|x64.Build.0 = Release|Any CPU
207199
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Release|x86.ActiveCfg = Release|Any CPU
208-
{D2DF44FE-098D-48EF-925B-F71DFDD7134D}.Release|x86.Build.0 = Release|Any CPU
209200
EndGlobalSection
210201
GlobalSection(SolutionProperties) = preSolution
211202
HideSolutionNode = FALSE

Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@
55
<SolutionDir Condition="'$(SolutionDir)' == ''">$(MSBuildThisFileDirectory)</SolutionDir>
66
</PropertyGroup>
77

8+
<!-- Convert $(BLLUseLocalNugetPackages) to bool -->
9+
<PropertyGroup>
10+
<BLLUseLocalNugetPackages Condition="'$(BLLUseLocalNugetPackages)' == ''">false</BLLUseLocalNugetPackages>
11+
</PropertyGroup>
12+
813
</Project>

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# Blazor Lazy Loading
2+
3+
[![demo](https://img.shields.io/badge/demo-click%20here-blue)](https://isc30.github.io/blazor-lazy-loading/)
4+
25
Automatic Lazy Loading support for Blazor WebAssembly (wasm) and Blazor Server

demo/Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
<Import Project="LocalNugetVersion.props" />
44

5+
<PropertyGroup>
6+
<!-- Polyfill $(SolutionDir) -->
7+
<SolutionDir Condition="'$(SolutionDir)' == ''">$(MSBuildThisFileDirectory)</SolutionDir>
8+
</PropertyGroup>
9+
510
<!-- Convert $(BLLUseLocalNugetPackages) to bool -->
611
<PropertyGroup>
712
<BLLUseLocalNugetPackages Condition="'$(BLLUseLocalNugetPackages)' == ''">false</BLLUseLocalNugetPackages>

demo/NuGet.Config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<add key="local-repo" value="../output/" />
4+
<add key="local-repo" value="../output/nuget/" />
55
</packageSources>
66
</configuration>

demo/WasmHost/wwwroot/404.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width" />
7+
8+
<base href="/" />
9+
<script type="text/javascript">
10+
// if domain ends with .github.io, fix <base href ...>
11+
if (window.location.host.endsWith(".github.io"))
12+
{
13+
var base = window.location.protocol
14+
+ "//" + window.location.host
15+
+ "/" + window.location.pathname.split("/")[1] + "/";
16+
17+
baseElement = document.getElementsByTagName("head")[0].getElementsByTagName("base")[0];
18+
baseElement.href = base;
19+
}
20+
</script>
21+
22+
<title>BlazorLazyLoading</title>
23+
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
24+
<link href="css/site.css" rel="stylesheet" />
25+
</head>
26+
27+
<body>
28+
<app>Loading...</app>
29+
30+
<div id="blazor-error-ui">
31+
An unhandled error has occurred.
32+
<a href="" class="reload">Reload</a>
33+
<a class="dismiss">🗙</a>
34+
</div>
35+
<script src="_framework/blazor.webassembly.js"></script>
36+
</body>
37+
38+
</html>

demo/WasmHost/wwwroot/index.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html>
22
<html>
33

44
<head>
55
<meta charset="utf-8" />
66
<meta name="viewport" content="width=device-width" />
7-
<title>WasmHost</title>
7+
88
<base href="/" />
9+
<script type="text/javascript">
10+
// if domain ends with .github.io, fix <base href ...>
11+
if (window.location.host.endsWith(".github.io"))
12+
{
13+
var base = window.location.protocol
14+
+ "//" + window.location.host
15+
+ "/" + window.location.pathname.split("/")[1] + "/";
16+
17+
baseElement = document.getElementsByTagName("head")[0].getElementsByTagName("base")[0];
18+
baseElement.href = base;
19+
}
20+
</script>
21+
22+
<title>BlazorLazyLoading</title>
923
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
1024
<link href="css/site.css" rel="stylesheet" />
1125
</head>

nuget.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<add key="local-repo" value="output/" />
4+
<add key="local-repo" value="output/nuget/" />
55
</packageSources>
66
</configuration>

nuget/BlazorLazyLoading.Module/BlazorLazyLoading.Module.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<None Remove="build\bin\**" />
2727
</ItemGroup>
2828

29-
<Target Name="CopyBinToBuild" AfterTargets="Build">
29+
<Target Name="CopyBinToBuild" AfterTargets="Build" Condition="!$(BLLUseLocalNugetPackages)">
3030
<Message Importance="high" Text="[HACK] Copying bin files..." />
3131
<ItemGroup>
3232
<BinFiles Include="$(MSBuildThisFileDirectory)bin/$(Configuration)/$(TargetFramework)/**/*.*" />

nuget/NugetCommon.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
</ItemGroup>
99

1010
<PropertyGroup>
11-
<PackageOutputDir>$(MSBuildThisFileDirectory)..\output</PackageOutputDir>
12-
<PackageOutputPath>$(MSBuildThisFileDirectory)..\output</PackageOutputPath>
11+
<PackageOutputDir>$(MSBuildThisFileDirectory)..\output\nuget</PackageOutputDir>
12+
<PackageOutputPath>$(MSBuildThisFileDirectory)..\output\nuget</PackageOutputPath>
1313
</PropertyGroup>
1414

1515
<PropertyGroup>
@@ -67,7 +67,7 @@
6767
</ItemGroup>
6868

6969
<WriteLinesToFile
70-
File="$(SolutionDir)demo/LocalNugetVersion.props"
70+
File="$(MSBuildThisFileDirectory)../demo/LocalNugetVersion.props"
7171
Lines="@(LocalNugetVersionProps)"
7272
Overwrite="true" />
7373
</Target>

output/demo/.nojekyll

Whitespace-only changes.
File renamed without changes.

0 commit comments

Comments
 (0)