Skip to content

Commit 27d49e8

Browse files
committed
Set up package publishing and adjust a bunch of project-related stuff for it
1 parent 1be9ef6 commit 27d49e8

File tree

7 files changed

+61
-12
lines changed

7 files changed

+61
-12
lines changed

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up .NET
17+
uses: actions/setup-dotnet@v3
18+
with:
19+
dotnet-version: '8.x'
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build the project
25+
run: dotnet build --configuration Release --no-restore
26+
27+
- name: Pack the project
28+
run: dotnet pack --configuration Release --no-build --output ./nupkg
29+
30+
- name: Publish to GitHub Packages
31+
run: dotnet nuget push ./nupkg/*.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Publish to NuGet.org
34+
run: dotnet nuget push ./nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}

.github/workflows/test.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
# This workflow will build the solution and run tests
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3-
4-
name: Tests
1+
name: Run Unit Tests
52

63
on:
74
push:
85
pull_request:
9-
branches:
6+
branches:
107
- main
118

129
jobs:
1310
build_and_test:
1411
runs-on: ubuntu-latest
1512

1613
steps:
17-
- uses: actions/checkout@v3
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
1817
- name: Setup .NET
1918
uses: actions/setup-dotnet@v3
2019
with:
21-
dotnet-version: 7.0.x
20+
dotnet-version: 8.0.x
21+
2222
- name: Restore dependencies
2323
run: dotnet restore
24+
2425
- name: Build
2526
run: dotnet build --no-restore --configuration Release
27+
2628
- name: Test
2729
run: dotnet test --no-build --configuration Release --verbosity normal

Benchmarks/Benchmarks.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
15+
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
1516
</ItemGroup>
1617

1718
<ItemGroup>

NuGet.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<configuration>
2+
<packageSources>
3+
<add key="GitHub" value="https://nuget.pkg.github.com/RudyTheDev/index.json" />
4+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
5+
</packageSources>
6+
</configuration>

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ The key differences from the [original VoronoiLib repo](https://github.com/Zalgo
1414

1515
Known issues:
1616
* The algorithm uses a lot of allocations, forcing garbage collection
17-
* There is no visual output/example since the original used MonoGame
1817

1918
# Examples
2019

@@ -112,7 +111,7 @@ A very simple MonoGame example is included in `MonoGameExample` project:
112111

113112
# Dependencies
114113

115-
The main library is compiled for .NET (Core) 6.0 and .NET Standard 2.0 at C# 8.0 and targets compatible OSes - Windows, Linux & macOS - and frameworks like Xamarin, Mono, UWP, or Unity.
114+
The main library is compiled for .NET 8.0 and .NET Standard 2.0 and targets compatible OSes - Windows, Linux & macOS - and .NET and Mono frameworks - Xamarin, Mono, UWP, Unity, etc.
116115

117116
# Credits
118117

SharpVoronoiLib/SharpVoronoiLib.csproj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4+
<Version>1.0.3</Version>
5+
<AssemblyVersion>1.0.0</AssemblyVersion>
46
<ImplicitUsings>disable</ImplicitUsings>
57
<Nullable>enable</Nullable>
68
<LangVersion>12</LangVersion>
@@ -13,12 +15,16 @@
1315
<PackageLicenseUrl>https://github.com/RudyTheDev/SharpVoronoiLib/blob/main/License.md</PackageLicenseUrl>
1416
<RepositoryUrl>https://github.com/RudyTheDev/SharpVoronoiLib</RepositoryUrl>
1517
<RepositoryType>git</RepositoryType>
16-
<PackageTags>voronoi lloyds fortune's</PackageTags>
17-
<PackageReleaseNotes>First release</PackageReleaseNotes>
18+
<PackageTags>voronoi lloyds fortune's tessellation </PackageTags>
19+
<PackageReleaseNotes></PackageReleaseNotes>
20+
<PackageReadmeFile>README.md</PackageReadmeFile>
1821
</PropertyGroup>
1922

2023
<ItemGroup>
21-
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
24+
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0">
25+
<PrivateAssets>all</PrivateAssets>
26+
</PackageReference>
27+
<None Include="..\README.md" Pack="true" PackagePath="\"/>
2228
</ItemGroup>
2329

2430
</Project>

UnitTests/UnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14+
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
1415
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
1516
<PackageReference Include="NUnit" Version="4.1.0" />
1617
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />

0 commit comments

Comments
 (0)