-
-
Notifications
You must be signed in to change notification settings - Fork 5
128 lines (108 loc) · 4.18 KB
/
publish-manual.yml
File metadata and controls
128 lines (108 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Manual NuGet Publish
on:
workflow_dispatch:
inputs:
reason:
description: 'Reason for manual publish'
required: false
default: 'Manual publish'
permissions:
contents: read
packages: write
env:
DOTNET_VERSION: '10.0.x'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
jobs:
publish:
name: Manually Publish to NuGet.org
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore SharpCoreDB.CI.slnf --configfile NuGet.Config
- name: Build
run: dotnet build SharpCoreDB.CI.slnf --configuration Release --no-restore /p:ContinuousIntegrationBuild=true
- name: Pack NuGet packages
run: dotnet pack SharpCoreDB.CI.slnf --configuration Release --output ./artifacts /p:ContinuousIntegrationBuild=true --configfile NuGet.Config
- name: Publish packages in dependency order
shell: bash
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
NUGET_SOURCE: https://api.nuget.org/v3/index.json
run: |
set -euo pipefail
push_layer() {
local layer_name="$1"
shift
local found_any=false
echo "::group::Publishing $layer_name"
for pattern in "$@"; do
for pkg in ./artifacts/${pattern}; do
[ -f "$pkg" ] || continue
found_any=true
echo " ↗ Pushing $(basename "$pkg")"
dotnet nuget push "$pkg" \
--api-key "$NUGET_API_KEY" \
--source "$NUGET_SOURCE" \
--skip-duplicate || true
done
done
echo "::endgroup::"
if [ "$found_any" = true ]; then
echo "⏳ Waiting 30s for NuGet.org to index $layer_name..."
sleep 30
fi
}
push_layer "Layer 0 (core)" \
"SharpCoreDB.[0-9]*.nupkg" \
"SharpCoreDB.Client.Protocol.*.nupkg" \
"SharpCoreDB.Server.Protocol.*.nupkg"
push_layer "Layer 1 (core dependents)" \
"SharpCoreDB.Graph.[0-9]*.nupkg" \
"SharpCoreDB.VectorSearch.*.nupkg" \
"SharpCoreDB.Functional.[0-9]*.nupkg" \
"SharpCoreDB.EventSourcing.*.nupkg" \
"SharpCoreDB.Analytics.*.nupkg" \
"SharpCoreDB.Distributed.*.nupkg" \
"SharpCoreDB.Identity.*.nupkg" \
"SharpCoreDB.Serilog.Sinks.*.nupkg"
push_layer "Layer 2 (mid-level)" \
"SharpCoreDB.Client.[0-9]*.nupkg" \
"SharpCoreDB.EntityFrameworkCore.[0-9]*.nupkg" \
"SharpCoreDB.Extensions.*.nupkg" \
"SharpCoreDB.Data.Provider.*.nupkg" \
"SharpCoreDB.Server.Core.*.nupkg" \
"SharpCoreDB.CQRS.*.nupkg" \
"SharpCoreDB.Projections.*.nupkg"
push_layer "Layer 3 (top-level)" \
"SharpCoreDB.Server.[0-9]*.nupkg" \
"SharpCoreDB.Graph.Advanced.*.nupkg" \
"SharpCoreDB.Provider.Sync.*.nupkg" \
"SharpCoreDB.Provider.YesSql.*.nupkg" \
"SharpCoreDB.Functional.Dapper.*.nupkg" \
"SharpCoreDB.Functional.EntityFrameworkCore.*.nupkg"
push_layer "Remaining packages" \
"*.nupkg"
echo "✅ All packages published in dependency order."
- name: Create release summary
run: |
echo "## 📦 Manual NuGet Publish Completed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Reason**: ${{ github.event.inputs.reason }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Published $(ls -1 ./artifacts/*.nupkg | wc -l) package(s) to NuGet.org" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Packages" >> $GITHUB_STEP_SUMMARY
ls -1 ./artifacts/*.nupkg | xargs -I {} basename {} >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Triggered by**: @${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
echo "**Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY