-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathazure_upload.ps1
More file actions
33 lines (27 loc) · 981 Bytes
/
Copy pathazure_upload.ps1
File metadata and controls
33 lines (27 loc) · 981 Bytes
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
# Load config
$config = Get-Content -Raw -Path ".\azure_config.json" | ConvertFrom-Json
# build
Write-Output "build..."
dotnet build --configuration Release
# cleanup
$sourceDir = "bin\Release\net8.0"
$destination = "$env:TEMP\detonatoragent.zip"
if (Test-Path $destination) {
Write-Output "cleanup: $destination"
Get-ChildItem $destination | Remove-Item -Force -ErrorAction SilentlyContinue
}
# make a zip (exclude logs directory)
Write-Output "zip: $sourceDir to $destination (excluding logs/)"
Get-ChildItem -Path $sourceDir -Exclude "logs" | Compress-Archive -DestinationPath $destination -Force
# Upload zip as blob
Write-Output "upload: $destination"
az storage blob upload `
--account-name $($config.StorageAccount) `
--container-name $($config.ContainerName) `
--name $($config.BlobName) `
--file $destination `
--sas-token """$($config.SasToken)""" `
--overwrite
# delete zip
Write-Output "cleanup..."
Get-ChildItem $destination | Remove-Item -Force