Skip to content

Commit 2a4d036

Browse files
committed
Fix source code directory structure
1 parent 5fc23ff commit 2a4d036

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,33 +70,25 @@ jobs:
7070
- name: Create Source Archive
7171
shell: pwsh
7272
run: |
73-
# Create source code archive (exclude .git, bin, obj, .vs, etc.)
74-
$excludePatterns = @('.git', '.github', 'bin', 'obj', '.vs', '.vscode', '*.user', 'packages', '.nuget')
75-
7673
$sourceDir = "."
7774
$archiveName = "SourceCode-${{ steps.version.outputs.version }}.zip"
75+
$excludes = @(".git", ".github", "bin", "obj", ".vs", ".vscode", "packages", ".nuget")
76+
77+
# Build exclusion arguments
78+
$excludeArgs = @()
79+
foreach ($exclude in $excludes) {
80+
$excludeArgs += "-xr!$exclude"
81+
}
82+
$excludeArgs += "-xr!*.user"
7883
79-
# Create temporary file list
80-
$tempFileList = New-TemporaryFile
81-
Get-ChildItem -Path $sourceDir -Recurse -File |
82-
Where-Object {
83-
$file = $_
84-
$excluded = $false
85-
foreach ($pattern in $excludePatterns) {
86-
if ($file.FullName -like "*$pattern*") {
87-
$excluded = $true
88-
break
89-
}
90-
}
91-
-not $excluded
92-
} |
93-
ForEach-Object { $_.FullName -replace [regex]::Escape("$sourceDir\"), "" } |
94-
Out-File -FilePath $tempFileList -Encoding UTF8
84+
# Create archive with directory structure preserved
85+
7z a -r $archiveName $sourceDir @excludeArgs
9586
96-
# Create archive
97-
7z a -w $sourceDir $archiveName @$tempFileList
87+
if ($LASTEXITCODE -ne 0) {
88+
Write-Host "7z exit code: $LASTEXITCODE"
89+
exit $LASTEXITCODE
90+
}
9891
99-
Remove-Item $tempFileList
10092
Write-Host "Created source archive: $archiveName"
10193
10294
- name: Create Executable Archive

0 commit comments

Comments
 (0)