-
Notifications
You must be signed in to change notification settings - Fork 6
/
Build.ps1
46 lines (32 loc) · 1.03 KB
/
Build.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function ZipFiles( $zipfilename, $sourcedir )
{
Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir, $zipfilename, $compressionLevel, $false)
}
$Error.Clear()
$source = Join-Path -Path $PSScriptRoot -ChildPath "src"
$target = Join-Path -Path $PSScriptRoot -ChildPath "release"
if (!(Test-Path $target))
{
Write-Host "Creating Release Directory"
New-Item $target -type Directory
}
else
{
Write-Host "Cleaning Release directory"
$removeItems = Join-Path $target "*"
remove-item $removeItems -recurse -force
}
$targetfile = Join-Path -Path $target -ChildPath "PoshColor.zip"
Write-Host "Creating release package $targetfile"
ZipFiles $targetfile $source
if ($Error.Count -eq 0)
{
Write-Host "Build Succesful" -ForegroundColor Green
}
else
{
Write-Host "One or more errors occured" -ForegroundColor Red
}
copy-item .\src\ .\release\PoshColor\ -recurse -container -force