Skip to content

Commit 754b938

Browse files
committed
build: enable rid-specific tool packaging
1 parent b05081b commit 754b938

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ jobs:
8787
- name: Pack dotnet tool with version from tag
8888
run: dotnet pack src/hypr.csproj --configuration Release --output ./nupkg -p:Version=${{ env.VERSION }}
8989

90+
- name: Smoke test packaged dotnet tool
91+
run: |
92+
dotnet tool install --tool-path ./tool-smoke --add-source ./nupkg hypr --version ${{ env.VERSION }}
93+
./tool-smoke/hypr --help
94+
9095
- name: Upload dotnet tool package
9196
uses: actions/upload-artifact@v4
9297
with:
@@ -166,6 +171,13 @@ jobs:
166171
with:
167172
user: ${{ secrets.NUGET_USER }}
168173

169-
- name: Publish to NuGet
170-
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
174+
- name: Publish RID-specific packages to NuGet
175+
shell: bash
176+
run: |
177+
shopt -s nullglob
178+
for package in ./nupkg/hypr.*.${{ env.VERSION }}.nupkg; do
179+
dotnet nuget push "$package" --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
180+
done
171181
182+
- name: Publish pointer package to NuGet
183+
run: dotnet nuget push ./nupkg/hypr.${{ env.VERSION }}.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Support for various package managers is available:
3131
dotnet tool install --global hypr
3232
```
3333

34+
On .NET 10 SDK-based installs, supported platforms automatically receive a self-contained tool package. Other platforms fall back to the framework-dependent `any` package.
35+
3436
## ⚡ Usage
3537

3638
### Create & Switch

src/hypr.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
<PackAsTool>true</PackAsTool>
2323
<ToolCommandName>hypr</ToolCommandName>
2424
<PackageOutputPath>./nupkg</PackageOutputPath>
25+
<RuntimeIdentifiers>win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64;any</RuntimeIdentifiers>
26+
<!-- Create self-contained tool packages for supported RIDs and keep an 'any' fallback package. -->
27+
<ToolPackageRuntimeIdentifiers>win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64;any</ToolPackageRuntimeIdentifiers>
28+
</PropertyGroup>
2529

26-
<!-- Publishing Configuration -->
30+
<PropertyGroup Condition="'$(RuntimeIdentifier)' != '' and '$(RuntimeIdentifier)' != 'any'">
31+
<!-- Standalone binaries only apply to RID-specific publishes and tool packages. -->
2732
<PublishSingleFile>true</PublishSingleFile>
2833
<SelfContained>true</SelfContained>
2934
<PublishTrimmed>true</PublishTrimmed>

0 commit comments

Comments
 (0)