feat: add CPZ file handling and logging in Docker workflow and build targets

This commit is contained in:
jtalborough
2025-02-27 18:30:26 -05:00
parent bacc0a4f57
commit 0944be2a70
2 changed files with 61 additions and 3 deletions

View File

@@ -66,8 +66,39 @@ jobs:
# Build the solutions in the docker image
- name: Build Solution
run: msbuild .\$($Env:SOLUTION_FILE).sln /p:Platform="Any CPU" /p:Configuration="Debug" /p:Version="${{ steps.setVersion.outputs.version }}" -m
- name: Debug CPZ Files
shell: powershell
run: |
Write-Host "Checking for CPZ files..."
$targetDir = ".\$($Env:SOLUTION_FILE)\bin\$($Env:BUILD_TYPE)\net472\"
$outputDir = ".\output\"
Write-Host "Files in target directory:"
Get-ChildItem -Path $targetDir -Recurse | Where-Object { $_.Extension -eq ".cpz" } | ForEach-Object { Write-Host $_.FullName }
Write-Host "Files in output directory:"
Get-ChildItem -Path $outputDir -Recurse | Where-Object { $_.Extension -eq ".cpz" } | ForEach-Object { Write-Host $_.FullName }
# Copy CPZ files to output if they exist but weren't copied
Get-ChildItem -Path $targetDir -Recurse | Where-Object { $_.Extension -eq ".cpz" } | ForEach-Object {
$destPath = Join-Path $outputDir "$($Env:SOLUTION_FILE)\$($_.Name)"
Write-Host "Copying $($_.FullName) to $destPath"
Copy-Item -Path $_.FullName -Destination $destPath -Force
}
- name: Pack Solution
run: dotnet pack .\$($Env:SOLUTION_FILE).sln --configuration $env:BUILD_TYPE --output ./output /p:Version="${{ steps.setVersion.outputs.version }}"
run: |
dotnet pack .\$($Env:SOLUTION_FILE).sln --configuration $env:BUILD_TYPE --output ./output /p:Version="${{ steps.setVersion.outputs.version }}" /p:IncludeSymbols=true /p:IncludeSource=true
# Ensure CPZ files are included in the package
$cpzFiles = Get-ChildItem -Path . -Recurse | Where-Object { $_.Extension -eq ".cpz" }
if ($cpzFiles.Count -eq 0) {
Write-Host "WARNING: No CPZ files found!"
} else {
Write-Host "Found $($cpzFiles.Count) CPZ files"
foreach ($file in $cpzFiles) {
Write-Host "CPZ file: $($file.FullName)"
}
}
- name: Create tag for non-rc builds
if: contains(steps.setVersion.outputs.version, 'alpha')
run: |
@@ -78,7 +109,7 @@ jobs:
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: 'output/**/*.{cpz,cplz}'
artifacts: 'output\**\*.*(cpz|cplz)'
generateReleaseNotes: true
prerelease: ${{contains('debug', env.BUILD_TYPE)}}
tag: ${{ steps.setVersion.outputs.version }}

View File

@@ -1,5 +1,10 @@
<Project>
<ItemGroup>
<!-- Ensure we're looking in all possible locations for CPZ files -->
<None Include="$(TargetDir)*.cpz" Condition="$(ProjectType) == 'Program'">
<Pack>true</Pack>
<PackagePath>build;</PackagePath>
</None>
<None Include="$(PackageOutputPath)\$(AssemblyName)\*.cpz" Condition="$(ProjectType) == 'Program'">
<Pack>true</Pack>
<PackagePath>build;</PackagePath>
@@ -27,7 +32,29 @@
<Message Text="TargetDir: '$(TargetDir)'" Importance="high" />
<Message Text="===============================================" Importance="high" />
</Target>
<Target Name="Copy CPZ NET472"
AfterTargets="Build"
DependsOnTargets="BuildDependencies"
Condition="'$(ProjectType)' == 'Program' And '$(TargetFramework)' == 'net472'">
<Message Text="========================================" Importance="high" />
<Message Text="Starting CPZ Build Process for NET472" Importance="high" />
<Message Text="ProjectType: '$(ProjectType)'" Importance="high" />
<Message Text="TargetFramework: '$(TargetFramework)'" Importance="high" />
<Message Text="========================================" Importance="high" />
<!-- Create output directory -->
<MakeDir Directories="$(PackageOutputPath)\$(AssemblyName)"
Condition="!Exists('$(PackageOutputPath)\$(AssemblyName)')" />
<!-- Copy the CPZ file -->
<Copy SourceFiles="$(TargetDir)$(TargetName).cpz"
DestinationFiles="$(PackageOutputPath)\$(AssemblyName)\$(TargetName).$(Version).$(TargetFramework).cpz"
Condition="Exists('$(TargetDir)$(TargetName).cpz')" />
<Message Text="CPZ Build completed for NET472"
Condition="Exists('$(PackageOutputPath)\$(AssemblyName)\$(TargetName).$(Version).$(TargetFramework).cpz')"
Importance="high" />
</Target>
<Target Name="Copy CPZ NET6"
AfterTargets="Build"
DependsOnTargets="BuildDependencies"