Skip to content

Commit 11c77ab

Browse files
committed
script updates
1 parent 74af23d commit 11c77ab

File tree

1 file changed

+46
-47
lines changed

1 file changed

+46
-47
lines changed

.github/workflows/template-publish.yml

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -172,62 +172,61 @@ jobs:
172172
$extractPath = "./nupkg-extracted"
173173
174174
Write-Host "Extracting NuGet package to verify contents..."
175-
if (Test-Path $extractPath) {
176-
Remove-Item -Path $extractPath -Recurse -Force
177-
}
178-
New-Item -Path $extractPath -ItemType Directory | Out-Null
179-
180-
# Extract the package using NuGet with full path instead of source
181-
Write-Host "Package path: $packagePath"
182175
if (Test-Path $packagePath) {
183-
# Use the NuGet CLI to extract the package directly
184-
nuget install CleanArchitecture.FullStack.Template -Version ${{ env.TEMPLATE_VERSION }} -OutputDirectory $extractPath -Source "./nupkg"
176+
Write-Host "Found package at: $packagePath"
185177
186-
# Alternative extraction using simple file extraction if needed
187-
if (!(Test-Path "$extractPath/CleanArchitecture.FullStack.Template")) {
188-
Write-Host "Using alternative extraction method..."
189-
$tempExtract = "$extractPath/temp"
190-
New-Item -Path $tempExtract -ItemType Directory -Force | Out-Null
191-
Copy-Item -Path $packagePath -Destination $tempExtract
192-
193-
$nupkgFile = Get-ChildItem -Path $tempExtract -Filter "*.nupkg" | Select-Object -First 1
194-
$extractedFolder = "$extractPath/CleanArchitecture.FullStack.Template"
195-
New-Item -Path $extractedFolder -ItemType Directory -Force | Out-Null
178+
# Create extract directory
179+
if (Test-Path $extractPath) {
180+
Remove-Item -Path $extractPath -Recurse -Force
181+
}
182+
New-Item -Path $extractPath -ItemType Directory -Force | Out-Null
183+
184+
# Simple direct extraction using Expand-Archive
185+
$packageName = [System.IO.Path]::GetFileName($packagePath)
186+
$packageBaseName = [System.IO.Path]::GetFileNameWithoutExtension($packagePath)
187+
188+
Write-Host "Copying package to .zip file for extraction"
189+
$zipPath = [System.IO.Path]::Combine($extractPath, "$packageBaseName.zip")
190+
Copy-Item -Path $packagePath -Destination $zipPath -Force
191+
192+
Write-Host "Extracting package from: $zipPath to: $extractPath"
193+
Expand-Archive -Path $zipPath -DestinationPath "$extractPath/$packageBaseName" -Force
194+
195+
# Look for README in various locations
196+
Write-Host "Searching for README.md in extracted package..."
197+
$readmeFiles = Get-ChildItem -Path $extractPath -Filter "README.md" -Recurse
198+
199+
if ($readmeFiles.Count -gt 0) {
200+
Write-Host "✅ README.md found at: $($readmeFiles[0].FullName)"
201+
}
202+
else {
203+
# Check common locations where README might be
204+
$commonLocations = @(
205+
"$extractPath/$packageBaseName/README.md",
206+
"$extractPath/$packageBaseName/content/README.md"
207+
)
196208
197-
# Rename .nupkg to .zip for extraction
198-
$zipPath = $nupkgFile.FullName -replace ".nupkg", ".zip"
199-
Copy-Item -Path $nupkgFile.FullName -Destination $zipPath
209+
$foundReadme = $false
210+
foreach ($location in $commonLocations) {
211+
if (Test-Path $location) {
212+
Write-Host "✅ README.md found at: $location"
213+
$foundReadme = $true
214+
break
215+
}
216+
}
200217
201-
# Extract the zip file
202-
Expand-Archive -Path $zipPath -DestinationPath $extractedFolder -Force
218+
if (-not $foundReadme) {
219+
# List all files in extraction directory to help diagnose
220+
Write-Host "Listing all extracted files:"
221+
Get-ChildItem -Path $extractPath -Recurse | ForEach-Object { Write-Host $_.FullName }
222+
223+
Write-Error "❌ README.md is missing from the NuGet package"
224+
}
203225
}
204226
}
205227
else {
206228
Write-Error "NuGet package not found at path: $packagePath"
207229
}
208-
209-
# Verify README exists
210-
# $readmePath = "$extractPath/CleanArchitecture.FullStack.Template.${{ env.TEMPLATE_VERSION }}/README.md"
211-
# if (Test-Path $readmePath) {
212-
# Write-Host "✅ README.md exists in the NuGet package at $readmePath"
213-
# }
214-
# else {
215-
# # Try alternative path
216-
# $altReadmePath = "$extractPath/CleanArchitecture.FullStack.Template/README.md"
217-
# if (Test-Path $altReadmePath) {
218-
# Write-Host "✅ README.md exists in the NuGet package at $altReadmePath"
219-
# }
220-
# else {
221-
# # Search for README.md anywhere in the extracted package
222-
# $readmeFiles = Get-ChildItem -Path $extractPath -Filter "README.md" -Recurse
223-
# if ($readmeFiles.Count -gt 0) {
224-
# Write-Host "✅ README.md found at: $($readmeFiles[0].FullName)"
225-
# }
226-
# else {
227-
# Write-Error "❌ README.md is missing from the NuGet package"
228-
# }
229-
# }
230-
# }
231230
232231
- name: Test template package
233232
run: |

0 commit comments

Comments
 (0)