-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPack.ps1
49 lines (38 loc) · 1.08 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
Function check-result {
if ($LastExitCode -ne 0) {
$e = [char]27
$start = "$e[1;31m"
$end = "$e[m"
$text = "ERROR: Exiting with error code $LastExitCode"
Write-Host "$start$text$end"
return $false
}
return $true
}
Function Invoke-Exe {
Param(
[parameter(Mandatory=$true)][string] $cmd,
[parameter(Mandatory=$true)][string] $args
)
Write-Host "Executing: `"$cmd`" --% $args"
Invoke-Expression "& `"$cmd`" $args"
$result = check-result
if (!$result) {
throw "ERROR executing EXE"
}
}
$ErrorActionPreference = 'Stop'
echo "build: Build started"
if(Test-Path .\artifacts) {
echo "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}
$version = @{ $true = $env:APPVEYOR_BUILD_VERSION; $false = "1.0.0" }[$env:APPVEYOR_BUILD_VERSION -ne $NULL];
echo "build: Version suffix is $suffix"
Get-ChildItem -include project.json -Recurse | Resolve-Path -Relative |
ForEach-Object{
$path = (Get-Item $_).DirectoryName
Write-Host "Found: $_ in $path"
echo "build: Packaging project in $src"
Invoke-Exe -cmd dotnet -args "pack $path -o artifacts"
}