@@ -204,14 +204,90 @@ jobs:
204204 name : nuget-packages
205205 path : ./artifacts
206206
207- - name : Publish to NuGet.org
208- run : dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
209-
207+ - name : Publish packages in dependency order
208+ shell : bash
209+ env :
210+ NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
211+ NUGET_SOURCE : https://api.nuget.org/v3/index.json
212+ run : |
213+ set -euo pipefail
214+
215+ push_layer() {
216+ local layer_name="$1"
217+ shift
218+ local found_any=false
219+
220+ echo "::group::Publishing $layer_name"
221+ for pattern in "$@"; do
222+ for pkg in ./artifacts/${pattern}; do
223+ [ -f "$pkg" ] || continue
224+ found_any=true
225+ echo " ↗ Pushing $(basename "$pkg")"
226+ dotnet nuget push "$pkg" \
227+ --api-key "$NUGET_API_KEY" \
228+ --source "$NUGET_SOURCE" \
229+ --skip-duplicate || true
230+ done
231+ done
232+ echo "::endgroup::"
233+
234+ # Wait for NuGet.org indexing before pushing the next layer
235+ if [ "$found_any" = true ]; then
236+ echo "⏳ Waiting 30s for NuGet.org to index $layer_name..."
237+ sleep 30
238+ fi
239+ }
240+
241+ # Layer 0 – no internal dependencies
242+ push_layer "Layer 0 (core)" \
243+ "SharpCoreDB.[0-9]*.nupkg" \
244+ "SharpCoreDB.Client.Protocol.*.nupkg" \
245+ "SharpCoreDB.Server.Protocol.*.nupkg"
246+
247+ # Layer 1 – depends on core only
248+ push_layer "Layer 1 (core dependents)" \
249+ "SharpCoreDB.Graph.[0-9]*.nupkg" \
250+ "SharpCoreDB.VectorSearch.*.nupkg" \
251+ "SharpCoreDB.Functional.[0-9]*.nupkg" \
252+ "SharpCoreDB.EventSourcing.*.nupkg" \
253+ "SharpCoreDB.Analytics.*.nupkg" \
254+ "SharpCoreDB.Distributed.*.nupkg" \
255+ "SharpCoreDB.Identity.*.nupkg" \
256+ "SharpCoreDB.Serilog.Sinks.*.nupkg"
257+
258+ # Layer 2 – depends on layer 1
259+ push_layer "Layer 2 (mid-level)" \
260+ "SharpCoreDB.Client.[0-9]*.nupkg" \
261+ "SharpCoreDB.EntityFrameworkCore.[0-9]*.nupkg" \
262+ "SharpCoreDB.Extensions.*.nupkg" \
263+ "SharpCoreDB.Data.Provider.*.nupkg" \
264+ "SharpCoreDB.Server.Core.*.nupkg" \
265+ "SharpCoreDB.CQRS.*.nupkg" \
266+ "SharpCoreDB.Projections.*.nupkg"
267+
268+ # Layer 3 – depends on layer 2
269+ push_layer "Layer 3 (top-level)" \
270+ "SharpCoreDB.Server.[0-9]*.nupkg" \
271+ "SharpCoreDB.Graph.Advanced.*.nupkg" \
272+ "SharpCoreDB.Provider.Sync.*.nupkg" \
273+ "SharpCoreDB.Provider.YesSql.*.nupkg" \
274+ "SharpCoreDB.Functional.Dapper.*.nupkg" \
275+ "SharpCoreDB.Functional.EntityFrameworkCore.*.nupkg"
276+
277+ # Catch any remaining packages not in the layers above
278+ push_layer "Remaining packages" \
279+ "*.nupkg"
280+
281+ echo "✅ All packages published in dependency order."
282+
210283 - name : Create release summary
211284 run : |
212- echo "## 📦 NuGet Packages Published" >> $GITHUB_STEP_SUMMARY
285+ echo "## 📦 NuGet Packages Published (Dependency-Ordered) " >> $GITHUB_STEP_SUMMARY
213286 echo "" >> $GITHUB_STEP_SUMMARY
214287 echo "Published $(ls -1 ./artifacts/*.nupkg | wc -l) package(s) to NuGet.org" >> $GITHUB_STEP_SUMMARY
215288 echo "" >> $GITHUB_STEP_SUMMARY
289+ echo "Packages were published in 4 layers based on their dependency chain," >> $GITHUB_STEP_SUMMARY
290+ echo "with 30-second waits between layers for NuGet.org indexing." >> $GITHUB_STEP_SUMMARY
291+ echo "" >> $GITHUB_STEP_SUMMARY
216292 echo "### Packages" >> $GITHUB_STEP_SUMMARY
217293 ls -1 ./artifacts/*.nupkg | xargs -I {} basename {} >> $GITHUB_STEP_SUMMARY
0 commit comments