Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
14 changes: 14 additions & 0 deletions .github/actions/cache-nuget/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Cache NuGet Packages'
description: 'Sets up caching for NuGet packages to speed up builds'
author: 'Kenny Pflug'

runs:
using: 'composite'
steps:
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
nuget-${{ runner.os }}-
7 changes: 1 addition & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ jobs:
with:
global-json-file: ./global.json
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
nuget-${{ runner.os }}-
uses: ./.github/actions/cache-nuget
- name: Restore dependencies
run: dotnet restore ./Light.TemporaryStreams.sln /p:ContinuousIntegrationBuild=true
- name: Build
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/release-on-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release on NuGet

on:
release:
types: [ published ]
workflow_dispatch:

jobs:
release-on-nuget:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: ./global.json
- name: Cache NuGet packages
uses: ./.github/actions/cache-nuget
- name: Prepare SNK file
env:
SNK: ${{ secrets.SNK }}
run: echo "$SNK" | base64 --decode > Light.TemporaryStreams.snk
- name: Create NuGet packages
# AssemblyOriginatorKeyFile must be a relative path from the csproj file that is being built, hence the ../../
run: dotnet pack ./Light.TemporaryStreams.sln --configuration Release /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=../../Light.TemporaryStreams.snk /p:ContinuousIntegrationBuild=true
- name: Delete SNK file
run: rm ./Light.TemporaryStreams.snk
- name: Push NuGet packages
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push "./src/**/*.nupkg" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
bin/
obj/
*.suo
*.user
*.user
Light.TemporaryStreams.snk
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</RestoreLockedMode>
<Authors>Kenny Pflug</Authors>
<Company>Kenny Pflug</Company>
<Copyright>Copyright (c) 2025 Kenny Pflug</Copyright>
<RootNamespace>Light.TemporaryStreams</RootNamespace>
<Version>1.0.0</Version>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Neovolve.Logging.Xunit.v3" Version="7.1.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1" />
<PackageVersion Include="xunit.v3" Version="2.0.3" />
Expand Down
Binary file added Light.TemporaryStreams.Public.snk
Binary file not shown.
12 changes: 12 additions & 0 deletions Light.TemporaryStreams.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
Light.TemporaryStreams.sln.DotSettings = Light.TemporaryStreams.sln.DotSettings
Directory.Packages.props = Directory.Packages.props
global.json = global.json
Light.TemporaryStreams.Public.snk = Light.TemporaryStreams.Public.snk
readme.md = readme.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{677E4EE1-7062-46AB-81FF-8D20E9316ED6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{05D48EEC-A2AB-4143-9533-A633E7B25EA3}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build-and-test.yml = .github\workflows\build-and-test.yml
.github\workflows\release-on-nuget.yml = .github\workflows\release-on-nuget.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{048D0C61-6CF0-43E6-B7DB-1FDD8F791D57}"
Expand All @@ -38,6 +41,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Light.TemporaryStreams", "s
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Light.TemporaryStreams.Tests", "tests\Light.TemporaryStreams.Tests\Light.TemporaryStreams.Tests.csproj", "{93CCDAD2-A16A-4BA3-A805-4FC7C4B518C8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "actions", "actions", "{68BCD857-ACA2-4D68-A0D5-1B0E92FD444B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cache-nuget", "cache-nuget", "{1D23A697-FFF5-4FA2-B540-5F8CBBF6863C}"
ProjectSection(SolutionItems) = preProject
.github\actions\cache-nuget\action.yml = .github\actions\cache-nuget\action.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -106,5 +116,7 @@ Global
{4D6B4F48-1E4B-4ACA-9F32-829442DB5E56} = {DA93B299-75F5-4A49-B2A6-4A1247047E5E}
{61725DD8-D81C-4EC0-A0A1-63D96A87DAC1} = {048D0C61-6CF0-43E6-B7DB-1FDD8F791D57}
{93CCDAD2-A16A-4BA3-A805-4FC7C4B518C8} = {DA93B299-75F5-4A49-B2A6-4A1247047E5E}
{68BCD857-ACA2-4D68-A0D5-1B0E92FD444B} = {677E4EE1-7062-46AB-81FF-8D20E9316ED6}
{1D23A697-FFF5-4FA2-B540-5F8CBBF6863C} = {68BCD857-ACA2-4D68-A0D5-1B0E92FD444B}
EndGlobalSection
EndGlobal
Loading