Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update XrefGen script and move app #437

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
env:
PUBLISH_DIR: 9.0/BlazorWebAssemblyXrefGenerator/bin/Release/net8.0/publish/wwwroot
PUBLISH_DIR: BlazorWebAssemblyXrefGenerator/bin/Release/net8.0/publish/wwwroot

on:
# Runs on pushes targeting the default branch
push:
paths:
- 9.0/BlazorWebAssemblyXrefGenerator/**
- BlazorWebAssemblyXrefGenerator/**

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -30,13 +30,20 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get latest .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.0'

- name: Publish app
run: dotnet publish 9.0/BlazorWebAssemblyXrefGenerator -c Release
run: dotnet publish BlazorWebAssemblyXrefGenerator -c Release

- name: Rewrite base href
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1
Expand All @@ -46,10 +53,12 @@ jobs:

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.PUBLISH_DIR }}

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
5 changes: 0 additions & 5 deletions 9.0/BlazorWebAssemblyXrefGenerator/README.md

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">Xref Generator</a>
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
Expand All @@ -14,16 +14,6 @@
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="weather">
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
</NavLink>
</div>
</nav>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/"
@page "/"
@using Microsoft.Extensions.Http
@inject IHttpClientFactory ClientFactory

Expand Down
32 changes: 32 additions & 0 deletions BlazorWebAssemblyXrefGenerator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# `BlazorWebAssemblyXrefGenerator`

Sample app to accompany [ASP.NET Core Blazor Host and Deploy: GitHub Pages](https://learn.microsoft.com/aspnet/core/blazor/host-and-deploy/webassembly#github-pages).

The Xref Generator tool is used by ASP.NET Core documentation authors to format API document links for ASP.NET Core article markdown.

This site is automatically deployed to GitHub Pages by a [GitHub Action script (`static.yml`)](https://github.com/dotnet/blazor-samples/blob/main/.github/workflows/static.yml).

GitHub settings:

* **Actions** > **General**
* **Actions permissions** > **Allow all actions and reusable workflows**
* **Workflow permissions**
* **Read repository contents and packages permissions**
* **Allow GitHub Actions to create and approve pull requests**: Enabled (selected)
* **Pages** > **Build and deployment**
* **Source** > **GitHub Actions**
* Selected workflow: **Static HTML** and use the [`static.yml` file](https://github.com/dotnet/blazor-samples/blob/main/.github/workflows/static.yml) for this site. Configure the following entries in the script for your deployment:
* Publish directory (`PUBLISH_DIR`)
* .NET SDK version (`dotnet-version` via the [`actions/setup-dotnet` Action](https://github.com/actions/setup-dotnet))
* Push path (`on:push:paths`)
* Publish path (`dotnet publish` command)
* Base HREF (`base_href` for the [`SteveSandersonMS/ghaction-rewrite-base-href` Action](https://github.com/SteveSandersonMS/ghaction-rewrite-base-href))
* **Custom domain**: Set if you intend to use a custom domain.
* **Enforce HTTPS**> Enabled (selected)

The GitHub-hosted Ubuntu (latest) server has a version of the .NET SDK installed. You can remove the [`actions/setup-dotnet` Action](https://github.com/actions/setup-dotnet) script step that installs the .NET SDK if the SDK pre-installed with the GitHub image is sufficient to compile the app. To determine the .NET SDK installed for `ubuntu-latest`:

1. Go to the [**Available Images** section of the `actions/runner-images` GitHub repository](https://github.com/actions/runner-images?tab=readme-ov-file#available-images).
1. Locate the `ubuntu-latest` image, which is the first table row.
1. Select the link in the `Included Software` column.
1. Scroll down to the [*.NET Tools* section](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#net-tools) to see the .NET Core SDK installed with the image.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
(l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);

</script>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions BlazorWebAssemblyXrefGenerator/wwwroot/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sitemap: https://dotnet.github.io/blazor-samples/sitemap.txt
1 change: 1 addition & 0 deletions BlazorWebAssemblyXrefGenerator/wwwroot/sitemap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://dotnet.github.io/blazor-samples/
Loading