Skip to content

Commit ea6dce0

Browse files
sharpninjaclaude
andcommitted
Add model weights to Core NuGet package and publish to GitHub Packages
- Generate default BitNet model weights (.gguf) during CI build and include them in the BitNetSharp.Core NuGet package as content files - Configure both Azure Pipelines and GitHub Actions to publish NuGet packages to https://nuget.pkg.github.com/sharpninja/index.json - Reference McpServer variable library for GH_TOKEN authentication in Azure Pipelines - Add nuget.config with GitHub Packages source and package source mapping to prevent dependency confusion - Bump version to 0.6.0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8d47ed6 commit ea6dce0

File tree

8 files changed

+57
-20
lines changed

8 files changed

+57
-20
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ jobs:
4545
- name: Test
4646
run: dotnet test BitNet-b1.58-Sharp.slnx --configuration Release --no-build --no-restore --filter "Category!=SlowLane"
4747

48+
- name: Generate default model weights
49+
run: |
50+
mkdir -p "${{ github.workspace }}/src/BitNetSharp.Core/Data/Models"
51+
dotnet run --framework net9.0 --project "${{ github.workspace }}/src/BitNetSharp.App/BitNetSharp.App.csproj" --configuration Release --no-build -- export --output="${{ github.workspace }}/src/BitNetSharp.Core/Data/Models/bitnet-b1.58-default.gguf"
52+
4853
- name: Pack BitNetSharp.Core
4954
run: dotnet pack "${{ github.workspace }}/src/BitNetSharp.Core/BitNetSharp.Core.csproj" --configuration Release --no-build --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.semVer }} --output "${{ github.workspace }}/artifacts/packages/core"
5055

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,6 @@ FodyWeavers.xsd
420420

421421
AGENTS-README-FIRST.yaml
422422
.mcpServer/
423+
424+
# Generated model weights (produced during CI builds)
425+
*.gguf

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0-78
1+
0.6.0

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>0.1.0</VersionPrefix>
3+
<VersionPrefix>0.6.0</VersionPrefix>
44
</PropertyGroup>
55
</Project>

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
next-version: 0.1.0
1+
next-version: 0.6.0
22
mode: ContinuousDelivery
33
tag-prefix: '[vV]?'
44
strategies:

azure-pipelines.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,21 @@ pr:
1313
- "*"
1414

1515
variables:
16-
BuildConfiguration: Release
17-
SolutionFile: BitNet-b1.58-Sharp.slnx
18-
CoreProject: src/BitNetSharp.Core/BitNetSharp.Core.csproj
19-
AppProject: src/BitNetSharp.App/BitNetSharp.App.csproj
20-
CoreArtifactName: BitNetSharp.Core-nuget
21-
ToolArtifactName: BitNetSharp.App-dotnet-tool
22-
NuGetFeedUrl: ""
23-
NuGetApiKey: ""
16+
- group: McpServer
17+
- name: BuildConfiguration
18+
value: Release
19+
- name: SolutionFile
20+
value: BitNet-b1.58-Sharp.slnx
21+
- name: CoreProject
22+
value: src/BitNetSharp.Core/BitNetSharp.Core.csproj
23+
- name: AppProject
24+
value: src/BitNetSharp.App/BitNetSharp.App.csproj
25+
- name: CoreArtifactName
26+
value: BitNetSharp.Core-nuget
27+
- name: ToolArtifactName
28+
value: BitNetSharp.App-dotnet-tool
29+
- name: NuGetFeedUrl
30+
value: "https://nuget.pkg.github.com/sharpninja/index.json"
2431

2532
stages:
2633
- stage: build
@@ -71,6 +78,12 @@ stages:
7178
- script: dotnet test "$(SolutionFile)" --configuration "$(BuildConfiguration)" --no-build --no-restore --filter "Category!=SlowLane"
7279
displayName: Test
7380

81+
- pwsh: |
82+
$modelsDirectory = "$(Build.SourcesDirectory)/src/BitNetSharp.Core/Data/Models"
83+
New-Item -ItemType Directory -Force -Path $modelsDirectory | Out-Null
84+
dotnet run --framework net9.0 --project "$(Build.SourcesDirectory)/$(AppProject)" --configuration "$(BuildConfiguration)" --no-build -- export --output="$modelsDirectory/bitnet-b1.58-default.gguf"
85+
displayName: Generate default model weights
86+
7487
- pwsh: |
7588
$outputDirectory = "$(Build.ArtifactStagingDirectory)/packages/core"
7689
New-Item -ItemType Directory -Force -Path $outputDirectory | Out-Null
@@ -157,16 +170,9 @@ stages:
157170
158171
foreach ($package in $packages)
159172
{
160-
if ([string]::IsNullOrWhiteSpace($env:NUGET_API_KEY))
161-
{
162-
dotnet nuget push $package.FullName --source $env:NUGET_SOURCE --api-key AzureArtifacts --skip-duplicate
163-
}
164-
else
165-
{
166-
dotnet nuget push $package.FullName --source $env:NUGET_SOURCE --api-key $env:NUGET_API_KEY --skip-duplicate
167-
}
173+
dotnet nuget push $package.FullName --source $env:NUGET_SOURCE --api-key $env:NUGET_API_KEY --skip-duplicate
168174
}
169175
displayName: Publish packages to NuGet feed
170176
env:
171177
NUGET_SOURCE: $(NuGetFeedUrl)
172-
NUGET_API_KEY: $(NuGetApiKey)
178+
NUGET_API_KEY: $(GH_TOKEN)

nuget.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
5+
<add key="github-sharpninja" value="https://nuget.pkg.github.com/sharpninja/index.json" />
6+
</packageSources>
7+
<packageSourceMapping>
8+
<packageSource key="nuget.org">
9+
<package pattern="*" />
10+
</packageSource>
11+
<packageSource key="github-sharpninja">
12+
<package pattern="BitNetSharp.*" />
13+
</packageSource>
14+
</packageSourceMapping>
15+
</configuration>

src/BitNetSharp.Core/BitNetSharp.Core.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,12 @@
1717
<PackageReference Include="System.Numerics.Tensors" Version="10.0.3" />
1818
</ItemGroup>
1919

20+
<ItemGroup Condition="Exists('Data/Models/bitnet-b1.58-default.gguf')">
21+
<Content Include="Data/Models/bitnet-b1.58-default.gguf"
22+
Pack="true"
23+
PackagePath="contentFiles/any/any/Models/"
24+
CopyToOutputDirectory="PreserveNewest"
25+
PackageCopyToOutput="true" />
26+
</ItemGroup>
27+
2028
</Project>

0 commit comments

Comments
 (0)