diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac4b5e8..2d8038a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,14 +92,14 @@ jobs: run: dotnet restore BitsKit.sln --locked-mode - name: Build - run: dotnet build BitsKit.sln --configuration Release --no-restore + run: dotnet build BitsKit.sln --configuration Release --no-restore -p:Version=0.0.0-ci.${{ github.run_number }} - name: Validate benchmark discovery shell: pwsh - run: ./eng/Run-Benchmarks.ps1 -Filter '*' -List -NoRestore + run: ./eng/Run-Benchmarks.ps1 -Filter '*' -List -NoRestore -NoBuild - name: Pack - run: dotnet pack BitsKit/BitsKit.csproj --configuration Release --no-build --no-restore --output artifacts -p:PackageVersion=0.0.0-ci.${{ github.run_number }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + run: dotnet pack BitsKit/BitsKit.csproj --configuration Release --no-build --no-restore --output artifacts -p:Version=0.0.0-ci.${{ github.run_number }} -p:PackageVersion=0.0.0-ci.${{ github.run_number }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg - name: Inspect package shell: pwsh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75b3447..88b8da4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: version: description: Package version for a non-publishing dry run required: true - default: 1.3.0-preview.1 + default: 1.6.1-preview.1 type: string permissions: @@ -74,10 +74,10 @@ jobs: run: dotnet restore BitsKit.sln --locked-mode - name: Build - run: dotnet build BitsKit.sln --configuration Release --no-restore + run: dotnet build BitsKit.sln --configuration Release --no-restore -p:Version=${{ steps.version.outputs.version }} - name: Build InlineArray consumer with modern compiler - run: dotnet build BitsKit.Tests/BitsKit.Tests.csproj --configuration Release --framework net10.0 --no-restore -p:LangVersion=preview + run: dotnet build BitsKit.Tests/BitsKit.Tests.csproj --configuration Release --framework net10.0 --no-restore -p:LangVersion=preview -p:Version=${{ steps.version.outputs.version }} - name: Test .NET 8 run: dotnet test BitsKit.Tests/BitsKit.Tests.csproj --configuration Release --framework net8.0 --no-build @@ -86,7 +86,7 @@ jobs: run: dotnet test BitsKit.Tests/BitsKit.Tests.csproj --configuration Release --framework net10.0 --no-build - name: Pack - run: dotnet pack BitsKit/BitsKit.csproj --configuration Release --no-build --no-restore --output artifacts -p:PackageVersion=${{ steps.version.outputs.version }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + run: dotnet pack BitsKit/BitsKit.csproj --configuration Release --no-build --no-restore --output artifacts -p:Version=${{ steps.version.outputs.version }} -p:PackageVersion=${{ steps.version.outputs.version }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg - name: Inspect package shell: pwsh diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dbe313..59ba7d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ Notable changes to the community-maintained fork are documented here. This proje ## Unreleased +## 1.6.1 - 2026-07-22 + +### Fixed + +- Release builds now apply the tag-derived version to package, assembly, file, and informational metadata for every shipped DLL. +- Package validation rejects artifacts whose embedded DLL versions do not match the expected package version. + ## 1.6.0 - 2026-07-22 ### Added diff --git a/Directory.Build.props b/Directory.Build.props index 7df42b5..2c8fd70 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 1.3.0 + 1.6.1 barncastle;RejectKid BitsKit is a library for efficient bit-level reading and writing also adding bit field support. BitsKit (community maintained) diff --git a/README.md b/README.md index d109c66..a54ff52 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ This fork preserves the original public API while maintaining it for current .NE Migrating from the original package normally requires only changing the package reference: ```xml - + ``` No namespace changes are required. Applications that still target .NET 6 or .NET 7 can consume the `netstandard2.1` asset when their target supports it, but those runtimes are no longer built or tested directly by this project. diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 4673d4f..2ce4db9 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,3 +1,7 @@ +v1.6.1 +- Apply the release version consistently to NuGet, assembly, file, and informational metadata. +- Validate every shipped DLL's embedded version before publishing a package. + v1.6.0 - Add opt-in unsafe generated accessors for callers that guarantee valid padded buffers. - Add allocation-free contiguous and strided batch primitives plus generated batch accessors. diff --git a/eng/Run-Benchmarks.ps1 b/eng/Run-Benchmarks.ps1 index 2306c34..67ad334 100644 --- a/eng/Run-Benchmarks.ps1 +++ b/eng/Run-Benchmarks.ps1 @@ -21,6 +21,8 @@ param( [switch] $NoRestore, + [switch] $NoBuild, + [switch] $List ) @@ -39,6 +41,10 @@ if ($NoRestore) { $arguments += '--no-restore' } +if ($NoBuild) { + $arguments += '--no-build' +} + $arguments += @( '--', '--filter', $Filter, diff --git a/eng/Validate-Package.ps1 b/eng/Validate-Package.ps1 index ffaa4c0..dd66ea4 100644 --- a/eng/Validate-Package.ps1 +++ b/eng/Validate-Package.ps1 @@ -61,6 +61,58 @@ try { throw "Expected package version '$ExpectedVersion', found '$($metadata.version)'." } + if ($ExpectedVersion -notmatch '^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?$') { + throw "Expected version '$ExpectedVersion' is not a supported semantic version." + } + + $expectedAssemblyVersion = "$($Matches[1]).$($Matches[2]).$($Matches[3]).0" + $assemblyEntries = @( + 'analyzers/dotnet/cs/BitsKit.Generator.dll', + 'lib/netstandard2.1/BitsKit.dll', + 'lib/net8.0/BitsKit.dll', + 'lib/net10.0/BitsKit.dll' + ) + $temporaryDirectory = Join-Path ([System.IO.Path]::GetTempPath()) ( + 'bitskit-package-validation-' + [System.Guid]::NewGuid().ToString('N')) + [void] [System.IO.Directory]::CreateDirectory($temporaryDirectory) + + try { + foreach ($entryName in $assemblyEntries) { + $assemblyEntry = $archive.GetEntry($entryName) + $temporaryAssembly = Join-Path $temporaryDirectory ($entryName.Replace('/', '_')) + $sourceStream = $assemblyEntry.Open() + $destinationStream = [System.IO.File]::Create($temporaryAssembly) + + try { + $sourceStream.CopyTo($destinationStream) + } + finally { + $destinationStream.Dispose() + $sourceStream.Dispose() + } + + $assemblyVersion = [System.Reflection.AssemblyName]::GetAssemblyName( + $temporaryAssembly).Version.ToString() + $fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($temporaryAssembly) + + if ($assemblyVersion -ne $expectedAssemblyVersion) { + throw "Expected '$entryName' assembly version '$expectedAssemblyVersion', found '$assemblyVersion'." + } + + if ($fileVersion.FileVersion -ne $expectedAssemblyVersion) { + throw "Expected '$entryName' file version '$expectedAssemblyVersion', found '$($fileVersion.FileVersion)'." + } + + if ($fileVersion.ProductVersion -ne $ExpectedVersion -and + -not $fileVersion.ProductVersion.StartsWith("$ExpectedVersion+", [System.StringComparison]::Ordinal)) { + throw "Expected '$entryName' product version '$ExpectedVersion', found '$($fileVersion.ProductVersion)'." + } + } + } + finally { + [System.IO.Directory]::Delete($temporaryDirectory, $true) + } + if ($metadata.repository.url -ne 'https://github.com/RejectKid/BitsKit') { throw "Unexpected repository URL '$($metadata.repository.url)'." }