-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.ps1
22 lines (17 loc) · 811 Bytes
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# from http://stackoverflow.com/questions/1153126/how-to-create-a-zip-archive-with-powershell#answer-13302548
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)
}
$handlersDirectory = "Handlers"
dotnet restore
dotnet publish -c release "$handlersDirectory"
if ($LASTEXITCODE -ne 0) { return }
$publishDirectory = "$handlersDirectory/bin/release/netcoreapp2.0/publish"
$packageName = "deploy-package.zip"
rm "$publishDirectory/$packageName" -ErrorAction SilentlyContinue
ZipFiles "$(pwd)/$packageName" "$(pwd)/$publishDirectory"
mv "$packageName" $publishDirectory