Skip to content

Commit ca5df1a

Browse files
author
Bryan Howard
committed
Fix build artifact preparation for Windows paths
- Handle invalid characters in version string for directory names - Add proper PowerShell shell specification - Add directory existence verification - Improve error handling and logging
1 parent 767bb34 commit ca5df1a

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/windows-build.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,34 @@ jobs:
9090
9191
- name: Prepare build artifact
9292
id: package
93+
shell: pwsh
9394
run: |
94-
$version = "${{ github.ref_name }}"
95+
# Extract version from tag, fallback to ref_name if not a tag
96+
if ("${{ github.ref }}" -like "refs/tags/*") {
97+
$version = "${{ github.ref_name }}"
98+
} else {
99+
$version = "dev-${{ github.sha }}".Substring(0, 15)
100+
}
101+
$version = $version -replace '[\/\\:*?"<>|]', '-' # Replace invalid characters
95102
$build_dir = "NodeEditor_Build"
96103
$dist_dir = Join-Path $build_dir "main.dist"
97104
105+
# Verify the directory exists
106+
if (-not (Test-Path $dist_dir)) {
107+
Write-Error "Build directory not found: $dist_dir"
108+
Get-ChildItem $build_dir -ErrorAction SilentlyContinue
109+
exit 1
110+
}
111+
98112
$new_dir_name = "PyFlowGraph $version"
99113
$zip_file_name = "PyFlowGraph_Windows_$version.zip"
100114
101-
Rename-Item -Path $dist_dir -NewName $new_dir_name
115+
Write-Host "Renaming $dist_dir to $new_dir_name"
116+
Rename-Item -Path $dist_dir -NewName $new_dir_name -Force
102117
103118
$archive_source = Join-Path $build_dir $new_dir_name
104-
Compress-Archive -Path "$archive_source\*" -DestinationPath $zip_file_name
119+
Write-Host "Creating archive from $archive_source"
120+
Compress-Archive -Path "$archive_source\*" -DestinationPath $zip_file_name -Force
105121
106122
echo "zip_name=$zip_file_name" >> $env:GITHUB_OUTPUT
107123
echo "version=$version" >> $env:GITHUB_OUTPUT

0 commit comments

Comments
 (0)