Skip to content

Commit

Permalink
Publish 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-a-thomas committed Sep 14, 2023
1 parent 8343ff4 commit 9ed3379
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and test

on:
push:
branches:
- 'main'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: PowerStatus/bin/Release/
33 changes: 33 additions & 0 deletions .github/workflows/tag-to-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to NuGet

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release --property:Version=${GITHUB_REF_NAME#v}
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release
- name: Pack
run: dotnet pack PowerStatus/PowerStatus.csproj --no-build --configuration Release --property:Version=${GITHUB_REF_NAME#v}
- name: Push
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: PowerStatus/bin/Release/
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"github.vscode-github-actions"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
}
15 changes: 14 additions & 1 deletion PowerStatus/PowerStatus.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>matthew-a-thomas</Authors>
<Description>C# wrapper for win32's System Power Status</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/matthew-a-thomas/win32-power-status</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/matthew-a-thomas/win32-power-status.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<None Include="..\README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.18-beta">
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion PowerStatus/PowerStatusProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public unsafe IDisposable Subscribe(
// received by the message queue for the window itself.
using var windowClass = new TransientClass((hWnd, msg, wParam, lParam) =>
{
if (msg != PInvoke.WM_POWERBROADCAST || wParam != PInvoke.PBT_POWERSETTINGCHANGE)
if (msg != PInvoke.WM_POWERBROADCAST || wParam.Value != PInvoke.PBT_POWERSETTINGCHANGE)
return PInvoke.DefWindowProc(hWnd, msg, wParam, lParam);
var powerBroadcast = (POWERBROADCAST_SETTING*)lParam.Value;
var powerSetting = powerBroadcast->PowerSetting;
Expand Down

0 comments on commit 9ed3379

Please sign in to comment.