Skip to content

Commit e0ee6a7

Browse files
authored
Add release workflow and update NuGet package metadata (#1)
## Summary - Added a GitHub Actions workflow (`.github/workflows/release.yml`) to automate building, testing, packaging, and publishing releases to GitHub Packages when a `v*` tag is pushed. Also creates a GitHub Release with generated release notes. - Added `RepositoryUrl`, `PackageProjectUrl`, and `RepositoryType` to `DotLuxafor.csproj` for better NuGet package traceability. - Increased timeouts in flaky hosted service tests to reduce CI timing failures on slow runners.
1 parent 6611864 commit e0ee6a7

3 files changed

Lines changed: 52 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: 10.x
24+
25+
- name: Restore
26+
run: dotnet restore
27+
28+
- name: Build
29+
run: dotnet build --no-restore -c Release
30+
31+
- name: Test
32+
run: dotnet test --no-build -c Release
33+
34+
- name: Set package version from tag
35+
run: echo "PACKAGE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
36+
37+
- name: Pack
38+
run: dotnet pack src/DotLuxafor/DotLuxafor.csproj --no-build -c Release -o artifacts /p:PackageVersion=${{ env.PACKAGE_VERSION }}
39+
40+
- name: Push to GitHub Packages
41+
run: dotnet nuget push "artifacts/*.nupkg" --no-symbols --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
42+
43+
- name: Create GitHub Release
44+
uses: softprops/action-gh-release@v2
45+
with:
46+
generate_release_notes: true
47+
files: artifacts/*

src/DotLuxafor/DotLuxafor.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1616
<PackageTags>luxafor;hid;led;usb;bluetooth</PackageTags>
1717
<PackageReadmeFile>README.md</PackageReadmeFile>
18+
<RepositoryUrl>https://github.com/vesnicancz/dotluxafor</RepositoryUrl>
19+
<PackageProjectUrl>https://github.com/vesnicancz/dotluxafor</PackageProjectUrl>
20+
<RepositoryType>git</RepositoryType>
1821
</PropertyGroup>
1922

2023
<ItemGroup>

tests/DotLuxafor.Tests/LuxaforHostedServiceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ public async Task ExecuteAsync_DeviceDisconnectsAndReconnects()
126126
var service = CreateService(options);
127127

128128
using var cts = CancellationTokenSource.CreateLinkedTokenSource(ct);
129-
cts.CancelAfter(TimeSpan.FromMilliseconds(500));
129+
cts.CancelAfter(TimeSpan.FromSeconds(5));
130130
await service.StartAsync(cts.Token);
131-
await Task.Delay(400, ct);
131+
await Task.Delay(2000, ct);
132132
await service.StopAsync(ct);
133133

134134
_deviceManager.Verify(m => m.TryOpen(), Times.AtLeast(2));

0 commit comments

Comments
 (0)