Skip to content

Commit 4ad8c65

Browse files
committed
updated test step
1 parent 5098500 commit 4ad8c65

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

.github/workflows/template-publish.yml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,59 @@ jobs:
100100
# Check that required files exist in template-output
101101
$requiredFiles = @(
102102
"docker-compose.yml",
103-
".env-example", directory and ensure all required files exist
103+
".env-example",
104104
"README.md"
105-
)cd test-project
105+
)
106106
107-
foreach ($file in $requiredFiles) {rrectly
108-
$filePath = "./template-output/$file"net new --list | findstr "cleanarch-fullstack"
107+
foreach ($file in $requiredFiles) {
108+
$filePath = "./template-output/$file"
109109
if (Test-Path $filePath) {
110-
Write-Host "✅ $file exists" template
111-
} else { dotnet new cleanarch-fullstack --Organization TestCompany
110+
Write-Host "✅ $file exists"
111+
} else {
112112
Write-Host "❌ $file is missing"
113-
# Create empty file if missing to prevent template validation errorsst files to verify creation
113+
# Create empty file if missing to prevent template validation errors
114114
New-Item -Path $filePath -ItemType File -Force
115-
dotnet nuget push ./nupkg/CleanArchitecture.FullStack.Template.${{ env.TEMPLATE_VERSION }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json run: | - name: Push to NuGet path: ./nupkg/*.nupkg name: nuget-package with: uses: actions/upload-artifact@v4 - name: Upload package artifact dotnet new cleanarch-fullstack --Organization TestCompany cd test-project mkdir test-project dotnet new install ./nupkg/CleanArchitecture.FullStack.Template.${{ env.TEMPLATE_VERSION }}.nupkg run: | - name: Test template package nuget pack ./template-output/CleanArchitecture.FullStack.Template.nuspec -OutputDirectory ./nupkg run: | - name: Pack template Write-Host "Template structure verification completed" } } New-Item -Path $dirPath -ItemType Directory -Force # Create directory if missing Write-Host "❌ $dir directory is missing" } else { Write-Host "✅ $dir directory exists" if (Test-Path $dirPath) { $dirPath = "./template-output/$dir" foreach ($dir in $requiredDirs) { ) "frontend" "backend", $requiredDirs = @( # Check that required directories exist } }
115+
}
116+
}
117+
118+
# Check that required directories exist
119+
$requiredDirs = @(
120+
"backend",
121+
"frontend"
122+
)
123+
124+
foreach ($dir in $requiredDirs) {
125+
$dirPath = "./template-output/$dir"
126+
if (Test-Path $dirPath) {
127+
Write-Host "✅ $dir directory exists"
128+
} else {
129+
Write-Host "❌ $dir directory is missing"
130+
# Create directory if missing
131+
New-Item -Path $dirPath -ItemType Directory -Force
132+
}
133+
}
134+
135+
Write-Host "Template structure verification completed"
136+
137+
- name: Pack template
138+
run: |
139+
nuget pack ./template-output/CleanArchitecture.FullStack.Template.nuspec -OutputDirectory ./nupkg
140+
141+
- name: Test template package
142+
run: |
143+
dotnet new install ./nupkg/CleanArchitecture.FullStack.Template.${{ env.TEMPLATE_VERSION }}.nupkg
144+
mkdir test-project
145+
cd test-project
146+
147+
# Verify template installed correctly
148+
dotnet new --list | findstr "cleanarch-fullstack"
149+
150+
# Create project from template
151+
dotnet new cleanarch-fullstack --Organization TestCompany
152+
153+
# List files to verify creation
154+
dir
155+
116156
- name: Upload package artifact
117157
uses: actions/upload-artifact@v4
118158
with:

0 commit comments

Comments
 (0)