Skip to content

Commit 07d3919

Browse files
committed
Fix: NuGet publish file path and add UTF-8 BOM
- Fixed wildcard path expansion issue in dotnet nuget push - Now iterates through nupkg files explicitly - Added UTF-8 BOM to PowerShell and markdown files - Added UTF-8 console encoding setup - Fixed emoji display (may show as ?? in Windows console but works in other contexts)
1 parent eafb725 commit 07d3919

2 files changed

Lines changed: 48 additions & 31 deletions

File tree

BUILD-AND-PUBLISH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SchemaMagic - Manual Build and Publish Guide
1+
# SchemaMagic - Manual Build and Publish Guide
22

33
## Prerequisites
44
1. .NET 9 SDK installed

publish-manual.ps1

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Version 7.0
1+
#Requires -Version 7.0
22

33
<#
44
.SYNOPSIS
@@ -37,6 +37,10 @@ param(
3737

3838
$ErrorActionPreference = "Stop"
3939

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+
4044
Write-Host ""
4145
Write-Host "?? SchemaMagic Manual Publish Script" -ForegroundColor Cyan
4246
Write-Host "=====================================" -ForegroundColor Cyan
@@ -177,35 +181,48 @@ if ($confirm -ne "y") {
177181

178182
# Publish
179183
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
185185

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
210190
exit 1
211191
}
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

Comments
 (0)