-
Notifications
You must be signed in to change notification settings - Fork 2k
/
pack.ps1
58 lines (47 loc) · 1.51 KB
/
pack.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
47
48
49
50
51
52
53
54
55
56
57
58
<#
.Synopsis
Pack cmder
.DESCRIPTION
Use this script to pack cmder into release archives
You will need to make this script executable by setting your Powershell Execution Policy to Remote signed
Then unblock the script for execution with UnblockFile .\pack.ps1
.EXAMPLE
.\pack.ps1
Creates default archives for cmder
.EXAMPLE
.\build -verbose
Creates default archives for cmder with plenty of information
.NOTES
AUTHORS
Samuel Vasko, Jack Bennett, Martin Kemp
Part of the Cmder project.
.LINK
https://github.com/cmderdev/cmder - Project Home
#>
[CmdletBinding(SupportsShouldProcess=$true)]
Param(
# CmdletBinding will give us;
# -verbose switch to turn on logging and
# -whatif switch to not actually make changes
# Path to the vendor configuration source file
[string]$cmderRoot = "..",
# Vendor folder locaton
[string]$saveTo = "..\build"
)
. "$PSScriptRoot\utils.ps1"
$ErrorActionPreference = "Stop"
Ensure-Executable "7z"
$targets = @{
"cmder.zip" = $null;
"cmder.7z" = $null;
"cmder_mini.zip" = "-x!`"vendor\git-for-windows`"";
}
Delete-Existing "..\Version*"
Delete-Existing "..\build\*"
$version = Invoke-Expression "git describe --abbrev=0 --tags"
(New-Item -ItemType file "$cmderRoot\Version $version") | Out-Null
foreach ($t in $targets.GetEnumerator()) {
Create-Archive $cmderRoot "$saveTo\$($t.Name)" $t.Value
$hash = (Digest-Hash "$saveTo\$($t.Name)")
Add-Content -path "$saveTo\hashes.txt" -value ($t.Name + ' ' + $hash)
}