Skip to content

Commit 099012c

Browse files
committed
Initial commit
0 parents  commit 099012c

36 files changed

Lines changed: 6675 additions & 0 deletions

.github/workflows/release.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# .github/workflows/release.yml
2+
#
3+
# Triggered by a semver tag (e.g. v1.2.3).
4+
#
5+
# Jobs:
6+
# build-windows — compiles WinToastWrapper.dll for win-x64 / win-x86 / win-arm64
7+
# using MSBuild on a Windows runner.
8+
# build-macos — compiles libMacNotifyWrapper.dylib for osx-arm64 and osx-x64
9+
# using clang cross-compilation on a macOS runner.
10+
# pack — downloads all native artifacts, packs the NuGet package with the
11+
# tag version, creates a GitHub Release, and optionally pushes to
12+
# NuGet.org (requires the NUGET_API_KEY repository secret).
13+
14+
name: Release
15+
16+
on:
17+
push:
18+
tags:
19+
- 'v[0-9]+.[0-9]+.[0-9]+'
20+
21+
permissions:
22+
contents: write # required to create GitHub Releases
23+
24+
# ---------------------------------------------------------------------------
25+
# Windows native build — three architectures in parallel
26+
# ---------------------------------------------------------------------------
27+
jobs:
28+
build-windows:
29+
name: Build WinToastWrapper (${{ matrix.rid }})
30+
runs-on: windows-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- { platform: x64, rid: win-x64 }
36+
- { platform: Win32, rid: win-x86 }
37+
- { platform: ARM64, rid: win-arm64 }
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Add MSBuild to PATH
44+
uses: microsoft/setup-msbuild@v2
45+
46+
- name: Build WinToastWrapper (${{ matrix.platform }})
47+
run: |
48+
msbuild native\WinToastWrapper\WinToastWrapper.vcxproj `
49+
/p:Configuration=Release `
50+
/p:Platform=${{ matrix.platform }} `
51+
/m `
52+
/nologo
53+
54+
# The vcxproj OutDir already targets runtimes/<rid>/native/ relative to the
55+
# repo root, so the DLL lands in the right place after a successful build.
56+
- name: Upload native artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: native-${{ matrix.rid }}
60+
path: runtimes/${{ matrix.rid }}/native/WinToastWrapper.dll
61+
if-no-files-found: error
62+
63+
# ---------------------------------------------------------------------------
64+
# macOS native build — both architectures on one runner via clang cross-compile
65+
# ---------------------------------------------------------------------------
66+
build-macos:
67+
name: Build MacNotifyWrapper (osx-arm64 + osx-x64)
68+
runs-on: macos-latest
69+
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
74+
# The Makefile targets arm64-apple-macos11.0 and x86_64-apple-macos10.14
75+
# using -arch flags; cross-compilation works on both Intel and Apple Silicon
76+
# runners because Xcode ships cross-compilers for both targets.
77+
- name: Build dylibs and install to runtimes/
78+
run: make -C native/MacNotifyWrapper install
79+
80+
- name: Upload osx-arm64 artifact
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: native-osx-arm64
84+
path: runtimes/osx-arm64/native/libMacNotifyWrapper.dylib
85+
if-no-files-found: error
86+
87+
- name: Upload osx-x64 artifact
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: native-osx-x64
91+
path: runtimes/osx-x64/native/libMacNotifyWrapper.dylib
92+
if-no-files-found: error
93+
94+
# ---------------------------------------------------------------------------
95+
# NuGet pack and GitHub Release
96+
# ---------------------------------------------------------------------------
97+
pack:
98+
name: Pack NuGet and publish release
99+
needs: [build-windows, build-macos]
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v4
105+
106+
# Strip the leading 'v' from the tag (v1.2.3 → 1.2.3) for use as the
107+
# NuGet package version and .NET assembly version.
108+
- name: Extract version from tag
109+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
110+
111+
# Download every native-* artifact into artifact-staging/<artifact-name>/
112+
# Each artifact contains a single file at its root (no subdirectory).
113+
- name: Download native artifacts
114+
uses: actions/download-artifact@v4
115+
with:
116+
pattern: native-*
117+
path: artifact-staging/
118+
119+
# Reconstruct the runtimes/ tree that the .csproj Content items reference.
120+
# The Condition="Exists(...)" guards in the .csproj will only bundle a file
121+
# if it is present here, so all five binaries must be staged before packing.
122+
- name: Stage native binaries into runtimes/
123+
run: |
124+
mkdir -p \
125+
runtimes/win-x64/native \
126+
runtimes/win-x86/native \
127+
runtimes/win-arm64/native \
128+
runtimes/osx-x64/native \
129+
runtimes/osx-arm64/native
130+
cp artifact-staging/native-win-x64/WinToastWrapper.dll runtimes/win-x64/native/
131+
cp artifact-staging/native-win-x86/WinToastWrapper.dll runtimes/win-x86/native/
132+
cp artifact-staging/native-win-arm64/WinToastWrapper.dll runtimes/win-arm64/native/
133+
cp artifact-staging/native-osx-x64/libMacNotifyWrapper.dylib runtimes/osx-x64/native/
134+
cp artifact-staging/native-osx-arm64/libMacNotifyWrapper.dylib runtimes/osx-arm64/native/
135+
136+
- name: Setup .NET
137+
uses: actions/setup-dotnet@v4
138+
with:
139+
dotnet-version: '8.x'
140+
141+
# -p:Version overrides the hardcoded version in the .csproj for this build.
142+
# --no-restore is safe here because we only need the managed code compiled;
143+
# the native binaries are staged directly without a restore step.
144+
- name: Pack NuGet package
145+
run: |
146+
dotnet pack src/Notify.NET/Notify.NET.csproj \
147+
--configuration Release \
148+
-p:Version=${{ env.VERSION }} \
149+
--output ./nupkg
150+
151+
- name: Create GitHub Release
152+
uses: softprops/action-gh-release@v2
153+
with:
154+
files: ./nupkg/*.nupkg
155+
generate_release_notes: true
156+
fail_on_unmatched_files: true
157+
158+
# Requires the NUGET_API_KEY repository secret to be configured.
159+
# Skip this step silently if the secret is absent.
160+
- name: Push to NuGet.org
161+
if: ${{ secrets.NUGET_API_KEY != '' }}
162+
run: |
163+
dotnet nuget push ./nupkg/*.nupkg \
164+
--api-key ${{ secrets.NUGET_API_KEY }} \
165+
--source https://api.nuget.org/v3/index.json \
166+
--skip-duplicate

.gitignore

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
### C++
2+
# Object files
3+
*.o
4+
*.obj
5+
6+
# Precompiled Headers
7+
*.gch
8+
*.pch
9+
10+
# Dynamic libraries
11+
*.so
12+
*.dylib
13+
*.dll
14+
15+
# Static libraries
16+
*.a
17+
*.lib
18+
19+
# Executables
20+
*.exe
21+
*.out
22+
23+
# Linker output
24+
*.ilk
25+
*.map
26+
*.exp
27+
28+
# Debug files
29+
*.dSYM/
30+
*.idb
31+
*.pdb
32+
33+
### C#
34+
# Build results
35+
[Bb]in/
36+
[Oo]bj/
37+
38+
# Visual Studio cache/options directory
39+
.vs/
40+
41+
# User-specific files
42+
*.suo
43+
*.user
44+
45+
# Debug symbols
46+
*.pdb
47+
48+
# NuGet Packages
49+
*.nupkg
50+
**/[Pp]ackages/*
51+
!**/[Pp]ackages/build/
52+
53+
# .NET build artifacts
54+
artifacts/
55+
56+
# Publish output
57+
publish/
58+
59+
### Objective-C
60+
# Xcode user settings
61+
xcuserdata/
62+
63+
# Xcode build data
64+
DerivedData/
65+
66+
# Obj-C/Swift specific
67+
*.hmap
68+
69+
# App packaging
70+
*.ipa
71+
*.dSYM.zip
72+
*.dSYM
73+
74+
# Playgrounds
75+
timeline.xctimeline
76+
playground.xcworkspace
77+
78+
### macOS
79+
# Finder metadata
80+
.DS_Store
81+
82+
# Thumbnails
83+
._*
84+
85+
# Custom folder icons
86+
Icon
87+
88+
# Volume root files
89+
.DocumentRevisions-V100
90+
.fseventsd
91+
.Spotlight-V100
92+
.TemporaryItems
93+
.Trashes
94+
.VolumeIcon.icns
95+
.com.apple.timemachine.donotpresent
96+
97+
### Windows
98+
# Windows thumbnail cache files
99+
Thumbs.db
100+
101+
# Folder config file
102+
[Dd]esktop.ini
103+
104+
# Recycle Bin used on file shares
105+
$RECYCLE.BIN/
106+
107+
# Windows shortcuts
108+
*.lnk
109+
110+
### Linux
111+
# Backup files
112+
*~
113+
114+
# Temporary files from deleted open files
115+
.fuse_hidden*
116+
117+
# KDE directory preferences
118+
.directory
119+
120+
# Linux trash folder
121+
.Trash-*
122+
123+
# NFS temporary files
124+
.nfs*
125+
126+
### JetBrains
127+
# JetBrains IDE directory
128+
.idea/
129+
130+
# CMake build directories
131+
cmake-build-*/
132+
133+
# File-based project format
134+
*.iws
135+
*.iml
136+
137+
# IntelliJ build output
138+
out/
139+
140+
### VisualStudio
141+
# User-specific files
142+
*.suo
143+
*.user
144+
145+
# Build results
146+
[Dd]ebug/
147+
[Rr]elease/
148+
x64/
149+
x86/
150+
[Ww][Ii][Nn]32/
151+
[Aa][Rr][Mm]/
152+
[Aa][Rr][Mm]64/
153+
[Bb]in/
154+
[Oo]bj/
155+
156+
# Visual Studio cache/options directory
157+
.vs/
158+
159+
# MSTest test Results
160+
[Tt]est[Rr]esult*/
161+
[Bb]uild[Ll]og.*
162+
163+
# NuGet
164+
*.nupkg
165+
**/[Pp]ackages/*
166+
!**/[Pp]ackages/build/
167+
*.nuget.props
168+
*.nuget.targets
169+
170+
# Publish Web Output
171+
*.[Pp]ublish.xml

Notify.NET.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31903.59
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Notify.NET", "src\Notify.NET\Notify.NET.csproj", "{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Notify.NET.Sample", "samples\Notify.NET.Sample\Notify.NET.Sample.csproj", "{B2C3D4E5-F6A7-8901-BCDE-F12345678901}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
EndGlobal

0 commit comments

Comments
 (0)