|
1 | | -#Requires -Version 7.0 |
| 1 | +#Requires -Version 7.0 |
2 | 2 |
|
3 | 3 | <# |
4 | 4 | .SYNOPSIS |
@@ -37,6 +37,10 @@ param( |
37 | 37 |
|
38 | 38 | $ErrorActionPreference = "Stop" |
39 | 39 |
|
| 40 | +# Set console encoding to UTF-8 to display emojis correctly |
| 41 | +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 |
| 42 | +$OutputEncoding = [System.Text.Encoding]::UTF8 |
| 43 | + |
40 | 44 | Write-Host "" |
41 | 45 | Write-Host "?? SchemaMagic Manual Publish Script" -ForegroundColor Cyan |
42 | 46 | Write-Host "=====================================" -ForegroundColor Cyan |
@@ -177,35 +181,48 @@ if ($confirm -ne "y") { |
177 | 181 |
|
178 | 182 | # Publish |
179 | 183 | Write-Host "" |
180 | | -Write-Host "?? Publishing to NuGet.org..." -ForegroundColor Yellow |
181 | | -dotnet nuget push ./nupkg/*.nupkg ` |
182 | | - --api-key $API_KEY ` |
183 | | - --source https://api.nuget.org/v3/index.json ` |
184 | | - --skip-duplicate |
| 184 | +Write-Host "🚀 Publishing to NuGet.org..." -ForegroundColor Yellow |
185 | 185 |
|
186 | | -if ($LASTEXITCODE -eq 0) { |
187 | | - Write-Host "" |
188 | | - Write-Host "? Published successfully!" -ForegroundColor Green |
189 | | - Write-Host "" |
190 | | - Write-Host "?? Package URL: https://www.nuget.org/packages/SchemaMagic/$SIMPLE_VERSION" -ForegroundColor Cyan |
191 | | - Write-Host "" |
192 | | - Write-Host "?? Next steps:" -ForegroundColor Yellow |
193 | | - Write-Host " 1. Wait 5-10 minutes for NuGet indexing" -ForegroundColor White |
194 | | - Write-Host " 2. Create git tag:" -ForegroundColor White |
195 | | - Write-Host " git tag -a v$VERSION -m 'Release v$VERSION'" -ForegroundColor Cyan |
196 | | - Write-Host " 3. Push tag to GitHub:" -ForegroundColor White |
197 | | - Write-Host " git push origin v$VERSION" -ForegroundColor Cyan |
198 | | - Write-Host " 4. Test installation:" -ForegroundColor White |
199 | | - Write-Host " dotnet tool update -g SchemaMagic" -ForegroundColor Cyan |
200 | | - Write-Host "" |
201 | | -} else { |
202 | | - Write-Host "" |
203 | | - Write-Host "? Publish failed with exit code $LASTEXITCODE" -ForegroundColor Red |
204 | | - Write-Host "" |
205 | | - Write-Host "Common issues:" -ForegroundColor Yellow |
206 | | - Write-Host " • API key expired or invalid" -ForegroundColor White |
207 | | - Write-Host " • Version already published (NuGet doesn't allow overwrites)" -ForegroundColor White |
208 | | - Write-Host " • Network connectivity issues" -ForegroundColor White |
209 | | - Write-Host "" |
| 186 | +# Get the actual nupkg file path |
| 187 | +$nupkgFiles = Get-ChildItem ./nupkg/*.nupkg -ErrorAction Stop |
| 188 | +if ($nupkgFiles.Count -eq 0) { |
| 189 | + Write-Host "❌ No .nupkg files found in ./nupkg/" -ForegroundColor Red |
210 | 190 | exit 1 |
211 | 191 | } |
| 192 | + |
| 193 | +Write-Host "📦 Found $($nupkgFiles.Count) package(s) to publish" -ForegroundColor Cyan |
| 194 | + |
| 195 | +foreach ($pkg in $nupkgFiles) { |
| 196 | + Write-Host " Publishing: $($pkg.Name)" -ForegroundColor White |
| 197 | + dotnet nuget push $pkg.FullName ` |
| 198 | + --api-key $API_KEY ` |
| 199 | + --source https://api.nuget.org/v3/index.json ` |
| 200 | + --skip-duplicate |
| 201 | + |
| 202 | + if ($LASTEXITCODE -ne 0) { |
| 203 | + Write-Host "" |
| 204 | + Write-Host "❌ Publish failed for $($pkg.Name) with exit code $LASTEXITCODE" -ForegroundColor Red |
| 205 | + Write-Host "" |
| 206 | + Write-Host "Common issues:" -ForegroundColor Yellow |
| 207 | + Write-Host " • API key expired or invalid" -ForegroundColor White |
| 208 | + Write-Host " • Version already published (NuGet doesn't allow overwrites)" -ForegroundColor White |
| 209 | + Write-Host " • Network connectivity issues" -ForegroundColor White |
| 210 | + Write-Host "" |
| 211 | + exit 1 |
| 212 | + } |
| 213 | +} |
| 214 | + |
| 215 | +Write-Host "" |
| 216 | +Write-Host "? Published successfully!" -ForegroundColor Green |
| 217 | +Write-Host "" |
| 218 | +Write-Host "?? Package URL: https://www.nuget.org/packages/SchemaMagic/$SIMPLE_VERSION" -ForegroundColor Cyan |
| 219 | +Write-Host "" |
| 220 | +Write-Host "?? Next steps:" -ForegroundColor Yellow |
| 221 | +Write-Host " 1. Wait 5-10 minutes for NuGet indexing" -ForegroundColor White |
| 222 | +Write-Host " 2. Create git tag:" -ForegroundColor White |
| 223 | +Write-Host " git tag -a v$VERSION -m 'Release v$VERSION'" -ForegroundColor Cyan |
| 224 | +Write-Host " 3. Push tag to GitHub:" -ForegroundColor White |
| 225 | +Write-Host " git push origin v$VERSION" -ForegroundColor Cyan |
| 226 | +Write-Host " 4. Test installation:" -ForegroundColor White |
| 227 | +Write-Host " dotnet tool update -g SchemaMagic" -ForegroundColor Cyan |
| 228 | +Write-Host "" |
0 commit comments