Skip to content

Add NuGet packaging support #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
###############################
# All files
[*]
charset = utf8
indent_style = space
indent_size = 4
insert_final_newline = true
charset = utf
indent_style = space
trim_trailing_whitespace = true

###############################
# File Extension Settings #
###############################

# Visual Studio Solution Files
[*.sln]
indent_style = tab

# Visual Studio XML Project Files
[*.{csproj,vbproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

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

Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/dotnet-core.yaml

This file was deleted.

88 changes: 88 additions & 0 deletions .github/workflows/dotnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: LSL.Net

on:
pull_request:
push:
branches: '*'
workflow_dispatch:
release:
types: [ published ]

jobs:
build:
name: Build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
6.0.x

- name: List installed .NET SDKs
run: dotnet --list-sdks

- name: Build
run: dotnet build -c Release LSL.Net.sln

- name: Pack
run: dotnet pack -c Release src/LSL.Net.slnf

- name: Setup library path
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: |
echo ${{ github.workspace }}
uname -a
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "DYLD_LIBRARY_PATH=${{ github.workspace }}/examples/LSLVer/bin/Release/net6.0" >> "$GITHUB_ENV"
else
echo "LD_LIBRARY_PATH=${{ github.workspace }}/examples/LSLVer/bin/Release/net6.0" >> "$GITHUB_ENV"
fi

- name: Run LSLVer
# LSL.Net.runtime for linux and macOS is not yet landed.
if: ${{ runner.os == 'Windows' }}
run: dotnet run -c Release -p examples/LSLVer/LSLVer.csproj -f net6.0

- name: Upload build artifacts
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: "**/*.*nupkg"

publish:
name: Publish
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'
steps:
- name: Install .NET SDK
uses: actions/setup-dotnet@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages

- name: Push NuGet packages
run: |
dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
generate_release_notes: true
files: |
**/*.nupkg
**/*.snupkg
16 changes: 13 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net35;netstandard2.0;net5.0;net6.0</TargetFrameworks>
<AnalysisLevel>latest</AnalysisLevel>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.16.2-preview.1</Version>
</PropertyGroup>

<PropertyGroup>
<Authors>Christian Kothe</Authors>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>1.12.2</Version>
<Company>Christian Kothe</Company>
<Copyright>Copyright © Christian Kothe 2021-2025</Copyright>
</PropertyGroup>
</Project>

14 changes: 14 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="LSL.Net" />
<!--
<PackageVersion Include="LSL.Net.runtime.win-x64" Version="1.16.2-preview.1" />
<PackageVersion Include="LSL.Net.runtime.win-x86" Version="1.16.2-preview.1" />
-->
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>
</Project>
Loading
Loading