forked from microsoft/azure-pipelines-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Compress-Tasks.ps1
24 lines (20 loc) · 893 Bytes
/
Compress-Tasks.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$IndividualZipStagingPath,
[Parameter(Mandatory = $true)]
[string]$WrapperZipStagingPath,
[Parameter(Mandatory = $true)]
[string]$ZipPath)
$ErrorActionPreference = 'Stop'
Add-Type -Assembly 'System.IO.Compression.FileSystem'
Get-ChildItem -LiteralPath $IndividualZipStagingPath |
ForEach-Object {
$sourceDir = $_.FullName
$targetDir = [System.IO.Path]::Combine($WrapperZipStagingPath, $_.Name)
Write-Host "Compressing $($_.Name)"
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, "$targetDir\task.zip")
}
Write-Host "Creating $([System.IO.Path]::GetFileName($ZipPath))"
$null = New-Item -Path ([System.IO.Path]::GetDirectoryName($ZipPath)) -ItemType Directory
[System.IO.Compression.ZipFile]::CreateFromDirectory($WrapperZipStagingPath, $ZipPath)