diff --git a/.github/workflows/nuget-ci-cd.yml b/.github/workflows/nuget-ci-cd.yml index eee0605..be8b16b 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,39 @@ 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 NuGet.org + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + shell: bash + run: | + shopt -s nullglob + packages=(src/artifacts/package/release/*.nupkg) + symbols=(src/artifacts/package/release/*.snupkg) - # - 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 }} + 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 - # - 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 }} + for pkg in "${packages[@]}"; 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 "${symbols[@]}"; 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/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 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.