Skip to content

Commit a875f26

Browse files
committed
Add NuGet packaging support
1 parent b347f0d commit a875f26

36 files changed

+680
-264
lines changed

.editorconfig

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,23 @@
44
###############################
55
# All files
66
[*]
7+
charset = utf8
8+
indent_style = space
79
indent_size = 4
810
insert_final_newline = true
9-
charset = utf
10-
indent_style = space
11+
trim_trailing_whitespace = true
12+
13+
###############################
14+
# File Extension Settings #
15+
###############################
16+
17+
# Visual Studio Solution Files
18+
[*.sln]
19+
indent_style = tab
20+
21+
# Visual Studio XML Project Files
22+
[*.{csproj,vbproj,vcxproj.filters,proj,projitems,shproj}]
23+
indent_size = 2
1124

1225
[*.{cs,csx,vb,vbx}]
1326

.github/workflows/dotnet-core.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/dotnet.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: LSL.Net
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: '*'
7+
workflow_dispatch:
8+
release:
9+
types: [ published ]
10+
11+
jobs:
12+
build:
13+
name: Build-${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ ubuntu-latest, windows-latest, macOS-latest ]
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Install .NET SDK
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: |
27+
5.0.x
28+
6.0.x
29+
30+
- name: List installed .NET SDKs
31+
run: dotnet --list-sdks
32+
33+
- name: Build
34+
run: dotnet build -c Release LSL.Net.sln
35+
36+
- name: Pack
37+
run: dotnet pack -c Release src/LSL.Net.slnf
38+
39+
- name: Setup library path
40+
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
41+
run: |
42+
echo ${{ github.workspace }}
43+
uname -a
44+
if [[ "$OSTYPE" == "darwin"* ]]; then
45+
echo "DYLD_LIBRARY_PATH=${{ github.workspace }}/examples/LSLVer/bin/Release/net6.0" >> "$GITHUB_ENV"
46+
else
47+
echo "LD_LIBRARY_PATH=${{ github.workspace }}/examples/LSLVer/bin/Release/net6.0" >> "$GITHUB_ENV"
48+
fi
49+
50+
- name: Run LSLVer
51+
# LSL.Net.runtime for linux and macOS is not yet landed.
52+
if: ${{ runner.os == 'Windows' }}
53+
run: dotnet run -c Release -p examples/LSLVer/LSLVer.csproj -f net6.0
54+
55+
- name: Upload build artifacts
56+
if: ${{ runner.os == 'Linux' }}
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: nuget-packages
60+
path: "**/*.*nupkg"
61+
62+
publish:
63+
name: Publish
64+
runs-on: ubuntu-latest
65+
needs: build
66+
if: github.event_name == 'release'
67+
steps:
68+
- name: Install .NET SDK
69+
uses: actions/setup-dotnet@v4
70+
71+
- name: Download artifacts
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: nuget-packages
75+
76+
- name: Push NuGet packages
77+
run: |
78+
dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
79+
80+
- name: Release
81+
uses: softprops/action-gh-release@v2
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
generate_release_notes: true
86+
files: |
87+
**/*.nupkg
88+
**/*.snupkg

Directory.Build.props

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project>
2+
<PropertyGroup>
3+
<TargetFrameworks>net35;netstandard2.0;net5.0;net6.0</TargetFrameworks>
4+
<AnalysisLevel>latest</AnalysisLevel>
5+
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
6+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
7+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
8+
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
9+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
10+
<Version>1.16.2-preview.1</Version>
11+
</PropertyGroup>
12+
13+
<PropertyGroup>
14+
<Authors>Christian Kothe</Authors>
15+
<Company>Christian Kothe</Company>
16+
<Copyright>Copyright © Christian Kothe 2021-2025</Copyright>
17+
</PropertyGroup>
18+
</Project>

Directory.Packages.props

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
6+
<ItemGroup>
7+
<PackageVersion Include="LSL.Net" />
8+
<!--
9+
<PackageVersion Include="LSL.Net.runtime.win-x64" Version="1.16.2-preview.1" />
10+
<PackageVersion Include="LSL.Net.runtime.win-x86" Version="1.16.2-preview.1" />
11+
-->
12+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
13+
</ItemGroup>
14+
</Project>

0 commit comments

Comments
 (0)