You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
920 B
37 lines
920 B
[CmdletBinding()]
|
|
param (
|
|
[Parameter(Mandatory = $true)]
|
|
[string] $PublishDir,
|
|
[Parameter(Mandatory = $true)]
|
|
[string] $OutputDir,
|
|
[string] $ArchiveDirName
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$archiveTargets = @()
|
|
if ($ArchiveDirName) {
|
|
$archiveTargets += "$ArchiveDirName"
|
|
}
|
|
else {
|
|
$archiveTargets += Get-ChildItem -Path $PublishDir -Directory -Name
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $OutputDir
|
|
$OutputDir = Resolve-Path $OutputDir
|
|
|
|
foreach ($dir in $archiveTargets) {
|
|
$archiveName = "recyclarr-$dir"
|
|
if ($dir.StartsWith("win-")) {
|
|
"> Zipping: $dir"
|
|
Compress-Archive "$PublishDir/$dir/*" "$OutputDir/$archiveName.zip" -Force
|
|
}
|
|
else {
|
|
"> Tarballing: $dir"
|
|
Push-Location "$PublishDir/$dir"
|
|
tar -cJv --owner=0 --group=0 -f "$archiveName.tar.xz" *
|
|
Move-Item "$archiveName.tar.xz" $OutputDir
|
|
Pop-Location
|
|
}
|
|
}
|