diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 609d7ac..4557f2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + fetch-tags: true - name: Setup .NET uses: actions/setup-dotnet@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cba6641..b0795bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + fetch-tags: true - name: Setup .NET uses: actions/setup-dotnet@v4 @@ -32,8 +33,12 @@ jobs: id: gitversion shell: bash run: | + MAJOR_MINOR_PATCH=$(dotnet gitversion /output json /showvariable MajorMinorPatch) + PRE_RELEASE_LABEL=$(dotnet gitversion /output json /showvariable PreReleaseLabel) VERSION=$(dotnet gitversion /output json /showvariable SemVer) SAFE_VERSION=$(echo "$VERSION" | sed -E 's/[^A-Za-z0-9._+-]+/-/g') + echo "MAJOR_MINOR_PATCH=$MAJOR_MINOR_PATCH" >> $GITHUB_ENV + echo "PRE_RELEASE_LABEL=$PRE_RELEASE_LABEL" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV echo "VERSION_SAFE=$SAFE_VERSION" >> $GITHUB_ENV @@ -113,6 +118,45 @@ jobs: echo "::error::Expected an existing git tag '${VERSION}' (or 'v${VERSION}') before creating a stable release." exit 1 + - name: Resolve Release Notes File + if: steps.release_channel.outputs.channel != 'none' + id: release_notes + shell: bash + run: | + if [ "${{ steps.release_channel.outputs.channel }}" = "stable" ]; then + notes_file="release-notes/${MAJOR_MINOR_PATCH}.md" + else + notes_file="release-notes/${MAJOR_MINOR_PATCH}-${{ steps.release_channel.outputs.channel }}.md" + fi + + if [ ! -f "${notes_file}" ]; then + fallback_notes_file="release-notes/${{ steps.release_channel.outputs.channel }}.md" + + if [ -f "${fallback_notes_file}" ]; then + notes_file="${fallback_notes_file}" + else + echo "::error::Expected release notes file '${notes_file}' was not found and fallback '${fallback_notes_file}' was not available." + exit 1 + fi + fi + + echo "file=${notes_file}" >> $GITHUB_OUTPUT + + - name: Render Release Notes + if: steps.release_channel.outputs.channel != 'none' + id: render_release_notes + shell: bash + run: | + rendered_notes_file="$(mktemp)" + + sed \ + -e "s/{{VERSION}}/${VERSION}/g" \ + -e "s/{{NUGET_VERSION}}/${VERSION}/g" \ + -e "s/{{MAJOR_MINOR_PATCH}}/${MAJOR_MINOR_PATCH}/g" \ + "${{ steps.release_notes.outputs.file }}" > "${rendered_notes_file}" + + echo "file=${rendered_notes_file}" >> $GITHUB_OUTPUT + - name: Create GitHub release if: steps.release_channel.outputs.channel != 'none' env: @@ -130,6 +174,9 @@ jobs: fi if gh release view "${{ steps.resolve_tag.outputs.tag }}" >/dev/null 2>&1; then + gh release edit "${{ steps.resolve_tag.outputs.tag }}" \ + --notes-file "${{ steps.render_release_notes.outputs.file }}" + gh release upload "${{ steps.resolve_tag.outputs.tag }}" \ /tmp/artifacts/blazor-hashrouting/package/release/Blazor.HashRouting.${VERSION}.nupkg \ /tmp/artifacts/blazor-hashrouting/package/release/Blazor.HashRouting.${VERSION}.snupkg \ @@ -140,6 +187,7 @@ jobs: /tmp/artifacts/blazor-hashrouting/package/release/Blazor.HashRouting.${VERSION}.snupkg \ --title "${{ steps.release_channel.outputs.label }} ${{ steps.resolve_tag.outputs.tag }}" \ --target "${GITHUB_SHA}" \ + --notes-file "${{ steps.render_release_notes.outputs.file }}" \ "${release_args[@]}" fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 4898b08..9388a38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,3 +4,11 @@ - Initial standalone release preparation. - Prepared the package for independent build, test, and NuGet packaging. + +## 1.0.0-rc.1 + +- First release candidate of `Blazor.HashRouting`. +- Added reusable hash-fragment routing for browser-hosted Blazor WebAssembly applications. +- Added canonical `/#/...` routing, internal link interception, back/forward handling, and navigation lock integration. +- Added standalone NuGet packaging, static web assets, and independent CI/release automation. +- Multi-targeted the package for `net9.0` and `net10.0`. diff --git a/release-notes/1.0.0-rc.md b/release-notes/1.0.0-rc.md new file mode 100644 index 0000000..aad34a6 --- /dev/null +++ b/release-notes/1.0.0-rc.md @@ -0,0 +1,50 @@ +# Blazor.HashRouting {{VERSION}} + +## Summary + +Release candidate build for the `{{MAJOR_MINOR_PATCH}}` line of `Blazor.HashRouting`, a reusable hash-fragment routing engine for browser-hosted Blazor WebAssembly applications. + +This package is intended for environments where the host can serve the application root document and static assets, but cannot reliably serve deep-linked route paths on refresh. + +## Highlights + +- Hash-fragment routing built on top of Blazor's navigation model +- Canonical `/#/...` URL handling +- Internal link interception for same-origin navigation +- Browser back/forward and hash change support +- Navigation lock integration +- Standalone NuGet-ready packaging with static web assets +- Multi-targeted for `net9.0` and `net10.0` + +## Installation + +```bash +dotnet add package Blazor.HashRouting --version {{NUGET_VERSION}} +``` + +## Basic usage + +```csharp +using Blazor.HashRouting; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); + +builder.Services.AddHashRouting(); + +await builder.Build().RunAsync(); +``` + +## URL examples + +- Root route: `/#/` +- Nested route: `/#/settings` +- Base-path route: `/proxy/app/#/settings` + +## Supported environments + +- Blazor WebAssembly running in a browser + +## Not supported + +- Blazor Server +- Blazor Hybrid diff --git a/release-notes/1.0.0.md b/release-notes/1.0.0.md new file mode 100644 index 0000000..8c640cc --- /dev/null +++ b/release-notes/1.0.0.md @@ -0,0 +1,50 @@ +# Blazor.HashRouting {{VERSION}} + +## Summary + +Stable release for the `{{MAJOR_MINOR_PATCH}}` line of `Blazor.HashRouting`, a reusable hash-fragment routing engine for browser-hosted Blazor WebAssembly applications. + +This package is intended for environments where the host can serve the application root document and static assets, but cannot reliably serve deep-linked route paths on refresh. + +## Highlights + +- Hash-fragment routing built on top of Blazor's navigation model +- Canonical `/#/...` URL handling +- Internal link interception for same-origin navigation +- Browser back/forward and hash change support +- Navigation lock integration +- Standalone NuGet-ready packaging with static web assets +- Multi-targeted for `net9.0` and `net10.0` + +## Installation + +```bash +dotnet add package Blazor.HashRouting --version {{NUGET_VERSION}} +``` + +## Basic usage + +```csharp +using Blazor.HashRouting; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); + +builder.Services.AddHashRouting(); + +await builder.Build().RunAsync(); +``` + +## URL examples + +- Root route: `/#/` +- Nested route: `/#/settings` +- Base-path route: `/proxy/app/#/settings` + +## Supported environments + +- Blazor WebAssembly running in a browser + +## Not supported + +- Blazor Server +- Blazor Hybrid diff --git a/release-notes/alpha.md b/release-notes/alpha.md new file mode 100644 index 0000000..3828893 --- /dev/null +++ b/release-notes/alpha.md @@ -0,0 +1,13 @@ +# Blazor.HashRouting {{VERSION}} + +## Summary + +Alpha build of `Blazor.HashRouting`. + +This prerelease is intended for early validation of hash-fragment routing in browser-hosted Blazor WebAssembly applications. + +## Installation + +```bash +dotnet add package Blazor.HashRouting --version {{NUGET_VERSION}} +``` \ No newline at end of file diff --git a/release-notes/beta.md b/release-notes/beta.md new file mode 100644 index 0000000..e4b1961 --- /dev/null +++ b/release-notes/beta.md @@ -0,0 +1,13 @@ +# Blazor.HashRouting {{VERSION}} + +## Summary + +Beta build of `Blazor.HashRouting`. + +This prerelease is intended for broader validation of hash-fragment routing in browser-hosted Blazor WebAssembly applications. + +## Installation + +```bash +dotnet add package Blazor.HashRouting --version {{NUGET_VERSION}} +``` \ No newline at end of file diff --git a/src/Blazor.HashRouting/Blazor.HashRouting.csproj b/src/Blazor.HashRouting/Blazor.HashRouting.csproj index 510ea78..150076a 100644 --- a/src/Blazor.HashRouting/Blazor.HashRouting.csproj +++ b/src/Blazor.HashRouting/Blazor.HashRouting.csproj @@ -25,13 +25,13 @@ - - + + - - + +