mirror of
https://github.com/radareorg/github-actions.git
synced 2026-11-07 06:25:58 -10:00
A bit more flexible zip flatten for windows
This commit is contained in:
1 parent
5e003dc6ef
commit
3c92cd5304
1 file changed
+4
-5
+4
-5
@@ -195,12 +195,11 @@ runs:
|
||||
}
|
||||
if (Test-Path $prefix) { Remove-Item -Path $prefix -Recurse -Force }
|
||||
Expand-Archive -Path $dest -DestinationPath $prefix -Force
|
||||
# Flatten nested subdirectory if present
|
||||
# Flatten the zip's single top-level directory unless bin/ is already at the root
|
||||
$subdirs = Get-ChildItem -Path $prefix -Directory
|
||||
if ($subdirs.Count -eq 1) {
|
||||
$subdir = $subdirs[0]
|
||||
Get-ChildItem -Path $subdir.FullName | Move-Item -Destination $prefix -Force
|
||||
Remove-Item -Path $subdir.FullName -Recurse -Force
|
||||
if ($subdirs.Count -eq 1 -and -not (Test-Path "$prefix\bin")) {
|
||||
Get-ChildItem -Path $subdirs[0].FullName | Move-Item -Destination $prefix -Force
|
||||
Remove-Item -Path $subdirs[0].FullName -Recurse -Force
|
||||
}
|
||||
$resolvedBin = (Resolve-Path "$prefix\bin").Path
|
||||
$resolvedBin | Out-File -Append -Encoding utf8 $env:GITHUB_PATH
|
||||
|
||||
Reference in new issue
Block a user