From 025aa50ee8cc4120e8242000194e453bb133acda Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Fri, 12 Jun 2026 09:37:06 +0700 Subject: [PATCH 1/3] Enable NuGet.org publishing and add package metadata. Publish RC builds on main merges and stable releases on version tags. Co-authored-by: Cursor --- .github/workflows/nuget-ci-cd.yml | 44 +++++++++++-------- harmony.sln | 1 + src/Directory.Build.targets | 19 ++++++++ src/SIL.Harmony.Core/SIL.Harmony.Core.csproj | 1 + .../SIL.Harmony.Linq2db.csproj | 2 + src/SIL.Harmony/SIL.Harmony.csproj | 1 + 6 files changed, 49 insertions(+), 19 deletions(-) create mode 100644 src/Directory.Build.targets diff --git a/.github/workflows/nuget-ci-cd.yml b/.github/workflows/nuget-ci-cd.yml index eee0605..1d85304 100644 --- a/.github/workflows/nuget-ci-cd.yml +++ b/.github/workflows/nuget-ci-cd.yml @@ -40,7 +40,7 @@ jobs: - name: Pack shell: bash run: | - dotnet pack --include-symbols /p:PackageVersion="$PACKAGE_VERSION" /p:AssemblyVersion="$ASSEMBLY_VERSION" /p:FileVersion="$FILE_VERSION" + dotnet pack /p:PackageVersion="$PACKAGE_VERSION" /p:AssemblyVersion="$ASSEMBLY_VERSION" /p:FileVersion="$FILE_VERSION" - name: Upload packages to build artifacts uses: actions/upload-artifact@v4 @@ -48,21 +48,27 @@ jobs: name: nuget-packages path: src/artifacts/package/release/*nupkg - # Not using the GitHub package registry right now, since it doesn't allow anonymous access so it's a hassle to use - - # - name: Publish package to GitHub - # if: github.event_name == 'pull_request' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads')) - # shell: bash - # run: | - # dotnet nuget push "src/artifacts/package/release/*.symbols.nupkg" -s https://nuget.pkg.github.com/sillsdev/index.json -k "$NUGET_API_KEY" --skip-duplicate - # env: - # NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }} - - # - name: Publish package to NuGet.org - # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - # shell: bash - # run: | - # echo Would run the following: - # echo dotnet nuget push "src/artifacts/package/release/*nupkg" --skip-duplicate --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json - # env: - # NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} + - name: Publish package to NuGet.org + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + shell: bash + run: | + shopt -s nullglob + for pkg in src/artifacts/package/release/*.nupkg; do + case "$pkg" in + *.symbols.nupkg|*.snupkg) continue ;; + esac + echo "Publishing $pkg" + dotnet nuget push "$pkg" \ + --skip-duplicate \ + --api-key "$NUGET_API_KEY" \ + --source https://api.nuget.org/v3/index.json + done + for sym in src/artifacts/package/release/*.snupkg; do + echo "Publishing symbols $sym" + dotnet nuget push "$sym" \ + --skip-duplicate \ + --api-key "$NUGET_API_KEY" \ + --source https://api.nuget.org/v3/index.json + done + env: + NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} diff --git a/harmony.sln b/harmony.sln index 8fc9d10..a44dc0d 100644 --- a/harmony.sln +++ b/harmony.sln @@ -18,6 +18,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{321635F9-11D9-4B45-A2F8-F3B70E9A4196}" ProjectSection(SolutionItems) = preProject src\Directory.Build.props = src\Directory.Build.props + src\Directory.Build.targets = src\Directory.Build.targets src\.editorconfig = src\.editorconfig EndProjectSection EndProject diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 0000000..7dc6fe2 --- /dev/null +++ b/src/Directory.Build.targets @@ -0,0 +1,19 @@ + + + SIL Global + SIL Global + Copyright © SIL Global + MIT + https://github.com/sillsdev/harmony + https://github.com/sillsdev/harmony + git + README.md + CRDT;offline-first;Entity Framework Core;synchronization;collaboration + true + snupkg + + + + + + diff --git a/src/SIL.Harmony.Core/SIL.Harmony.Core.csproj b/src/SIL.Harmony.Core/SIL.Harmony.Core.csproj index b390362..f1f8486 100644 --- a/src/SIL.Harmony.Core/SIL.Harmony.Core.csproj +++ b/src/SIL.Harmony.Core/SIL.Harmony.Core.csproj @@ -3,6 +3,7 @@ SIL.Harmony.Core true + Core types and interfaces for the Harmony CRDT library. diff --git a/src/SIL.Harmony.Linq2db/SIL.Harmony.Linq2db.csproj b/src/SIL.Harmony.Linq2db/SIL.Harmony.Linq2db.csproj index 1453659..e6c942a 100644 --- a/src/SIL.Harmony.Linq2db/SIL.Harmony.Linq2db.csproj +++ b/src/SIL.Harmony.Linq2db/SIL.Harmony.Linq2db.csproj @@ -3,6 +3,8 @@ SIL.Harmony.Linq2db true + linq2db integration for the Harmony CRDT library. + $(PackageTags);linq2db diff --git a/src/SIL.Harmony/SIL.Harmony.csproj b/src/SIL.Harmony/SIL.Harmony.csproj index f5ff35f..094fe40 100644 --- a/src/SIL.Harmony/SIL.Harmony.csproj +++ b/src/SIL.Harmony/SIL.Harmony.csproj @@ -3,6 +3,7 @@ SIL.Harmony true + CRDT application library for building offline-first apps with Entity Framework Core. From 3f6b0626661f1f88e574ffdf3adea8849e6a4217 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Fri, 12 Jun 2026 13:09:34 +0700 Subject: [PATCH 2/3] Add NuGet version badge to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7b8e061..cce1892 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # harmony +[![NuGet version](https://img.shields.io/nuget/v/SIL.Harmony.svg?style=flat-square)](https://www.nuget.org/packages/SIL.Harmony/) + A CRDT application library for C#, use it to build offline first applications. ## Install From 7b43f833ce355eb3f2e93d33e8710291d992d210 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Fri, 12 Jun 2026 14:05:03 +0700 Subject: [PATCH 3/3] Fail the run if there's no nuget packages Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/nuget-ci-cd.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nuget-ci-cd.yml b/.github/workflows/nuget-ci-cd.yml index 1d85304..be8b16b 100644 --- a/.github/workflows/nuget-ci-cd.yml +++ b/.github/workflows/nuget-ci-cd.yml @@ -53,7 +53,19 @@ jobs: shell: bash run: | shopt -s nullglob - for pkg in src/artifacts/package/release/*.nupkg; do + packages=(src/artifacts/package/release/*.nupkg) + symbols=(src/artifacts/package/release/*.snupkg) + + if ((${`#packages`[@]} == 0)); then + echo "No NuGet packages were produced." >&2 + exit 1 + fi + if ((${`#symbols`[@]} == 0)); then + echo "No symbol packages were produced." >&2 + exit 1 + fi + + for pkg in "${packages[@]}"; do case "$pkg" in *.symbols.nupkg|*.snupkg) continue ;; esac @@ -63,7 +75,7 @@ jobs: --api-key "$NUGET_API_KEY" \ --source https://api.nuget.org/v3/index.json done - for sym in src/artifacts/package/release/*.snupkg; do + for sym in "${symbols[@]}"; do echo "Publishing symbols $sym" dotnet nuget push "$sym" \ --skip-duplicate \