Skip to content

Commit b1fc1a9

Browse files
committed
Looks like it's ready for a first test drive to NuGet
1 parent 6ed5ce9 commit b1fc1a9

5 files changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/Publish-Package.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ jobs:
3939
with:
4040
fail_on_unmatched_files: true
4141
files: '**/*.nupkg'
42+
43+
- name: Release to NuGet.org
44+
if: startsWith(github.ref, 'refs/tags/')
45+
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}

CodeCaster.WindowsServiceExtensions.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeCaster.WindowsServiceEx
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4B4ADAD2-7E93-44E5-8376-3B11173671EE}"
99
ProjectSection(SolutionItems) = preProject
10+
LICENSE = LICENSE
1011
Readme.md = Readme.md
1112
EndProjectSection
1213
EndProject

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 CodeCaster
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ These extensions allow your IHostedServices to respond to this power state chang
88
* On your Host Builder, call `UsePowerEventAwareWindowsService()` instead of [`UseWindowsService()`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.hosting.windowsservicelifetimehostbuilderextensions.usewindowsservice?view=dotnet-plat-ext-3.1).
99
* Instead of letting your service inherit [`Microsoft.Extensions.Hosting.BackgroundService`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.hosting.backgroundservice?view=dotnet-plat-ext-5.0), inherit from `CodeCaster.WindowsServiceExtensions.PowerEventAwareBackgroundService`.
1010
* Implement the method `public override bool OnPowerEvent(PowerBroadcastStatus powerStatus)`
11+
12+
Do note that the statuses received can vary. You get either `ResumeSuspend`, `ResumeAutomatic` or both, never neither, after a machine wake, reboot or boot.

src/CodeCaster.WindowsServiceExtensions/CodeCaster.WindowsServiceExtensions.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,28 @@
44
<TargetFramework>net5.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
7+
<PackageProjectUrl>https://github.com/CodeCasterNL/WindowsServiceExtensions</PackageProjectUrl>
8+
<RepositoryUrl>https://github.com/CodeCasterNL/WindowsServiceExtensions</RepositoryUrl>
9+
<RepositoryType>GitHub</RepositoryType>
10+
<PackageTags></PackageTags>
11+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
12+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
13+
<Authors>CodeCaster</Authors>
14+
<Company />
15+
<Copyright>CodeCaster</Copyright>
16+
<Description>Makes your .NET 5 BackgroundServices power-event-aware.</Description>
717
</PropertyGroup>
818

919
<ItemGroup>
1020
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
1121
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
1222
</ItemGroup>
1323

24+
<ItemGroup>
25+
<None Include="..\..\LICENSE">
26+
<Pack>True</Pack>
27+
<PackagePath></PackagePath>
28+
</None>
29+
</ItemGroup>
30+
1431
</Project>

0 commit comments

Comments
 (0)