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.
recyclarr/ci/CreateArchive.ps1

37 lines
909 B

[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $PublishDir,
[Parameter(Mandatory = $true)]
[string] $OutputDir,
[string] $ArchiveDirName
)
$ErrorActionPreference = "Stop"
$archiveTargets = @()
if ($ArchiveDirName) {
$archiveTargets += "$PublishDir/$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 cJvf "$archiveName.tar.xz" *
Move-Item "$archiveName.tar.xz" $OutputDir
Pop-Location
}
}