Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
danzuep committed Jan 23, 2024
1 parent 664db23 commit 0dc2b42
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/_build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
outputs:
project_file:
description: 'The project file name'
value: ${{ jobs.build.outputs.project-file }}
value: ${{ jobs.build_website.outputs.project-file }}
page_url:
description: 'The webpage URL'
value: ${{ jobs.deploy.outputs.page_url }}
Expand Down Expand Up @@ -57,17 +57,20 @@ jobs:
- name: Restore project dependencies
run: |
dotnet restore ${{ env.PROJECT_PATH }}
dotnet publish ${{ env.PROJECT_PATH }} -c Release -p:GHPages=true -p:Version=${{ inputs.project-version }} -o ${{ inputs.project-output }} --no-restore --nologo
dotnet publish ${{ env.PROJECT_PATH }} -c:Release -p:GHPages=true -p:Version=${{ inputs.project-version }} -o:${{ inputs.project-output }} --no-restore --nologo
# "https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-8.0#github-pages"
# "To deploy folders starting with underscore, add an empty .nojekyll file to the Git branch."
- name: Add .nojekyll file
run: touch "${{ inputs.project-output }}/wwwroot/.nojekyll"

# https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-8.0#github-pages
# To handle URL rewrites, add a wwwroot/404.html file with a script that handles redirecting the request to the index.html page.
- name: copy index.html to 404.html
run: cp "${{ inputs.project-output }}/wwwroot/index.html" "${{ inputs.project-output }}/wwwroot/404.html"
# changes the base-tag in index.html from '/' to 'BlazorGitHubPagesDemo' to match GitHub Pages repository subdirectory
- name: Change base-tag in index.html from / to the repository name
run: |
echo 'Get the repository name.'
repositoryName=$(basename '${{ github.repository }}')
echo "Repository name: $repositoryName"
sed -i 's/<base href="\/" \/>/<base href="\/$repositoryName\/" \/>/g' release/wwwroot/index.html
- name: Setup Pages
uses: actions/configure-pages@v4
Expand Down
3 changes: 2 additions & 1 deletion Bible.Web/Bible.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
</PackageReleaseNotes>
<RunAOTCompilation>true</RunAOTCompilation>
<WasmStripILAfterAOT>true</WasmStripILAfterAOT>
<StaticWebAssetsEnabled>true</StaticWebAssetsEnabled>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.1" />
Expand Down
8 changes: 7 additions & 1 deletion Bible.Web/Components/Routes.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<Router AppAssembly="typeof(Program).Assembly" AdditionalAssemblies="new[] { typeof(Client._Imports).Assembly }">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
<RouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)" />
<FocusOnNavigate RouteData="routeData" Selector="h1" />
</Found>
@* <NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<h1>Page not found</h1>
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound> *@
</Router>
2 changes: 2 additions & 0 deletions Bible.Web/Components/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
@using Bible.Web.Client
@using Bible.Web.Client.Pages
@using Bible.Web.Components
@using Bible.Web.Components.Layout
@using Bible.Web.Components.Pages

0 comments on commit 0dc2b42

Please sign in to comment.