@@ -1,32 +1,13 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter()][string]$Architecture
|
||||
)
|
||||
|
||||
# Based on the template in: https://docs.digitalocean.com/reference/api/spaces-api/
|
||||
$ErrorActionPreference = "Stop"
|
||||
. "$PSScriptRoot\lib\blob-store.ps1"
|
||||
. "$PSScriptRoot\lib\workspace.ps1"
|
||||
|
||||
$allowedTargets = @("windows")
|
||||
|
||||
function Test-AllowedTarget {
|
||||
param (
|
||||
[string]$Target
|
||||
)
|
||||
|
||||
return $allowedTargets -contains $Target
|
||||
}
|
||||
|
||||
# Process arguments
|
||||
if ($args.Count -gt 0) {
|
||||
$target = $args[0]
|
||||
if (Test-AllowedTarget $target) {
|
||||
# Valid target
|
||||
} else {
|
||||
Write-Error "Error: Target '$target' is not allowed.`nUsage: $($MyInvocation.MyCommand.Name) [$($allowedTargets -join ', ')]"
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
Write-Error "Error: Target is not specified.`nUsage: $($MyInvocation.MyCommand.Name) [$($allowedTargets -join ', ')]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ParseZedWorkspace
|
||||
Write-Host "Uploading nightly for target: $target"
|
||||
|
||||
@@ -44,17 +25,8 @@ $sha | Out-File -FilePath "target/latest-sha" -NoNewline
|
||||
# Remove-Item -Path $file.FullName
|
||||
# }
|
||||
|
||||
switch ($target) {
|
||||
"windows" {
|
||||
UploadToBlobStore -BucketName $bucketName -FileToUpload $env:SETUP_PATH -BlobStoreKey "nightly/Zed-x86_64.exe"
|
||||
UploadToBlobStore -BucketName $bucketName -FileToUpload "target/latest-sha" -BlobStoreKey "nightly/latest-sha-windows"
|
||||
UploadToBlobStore -BucketName $bucketName -FileToUpload "target/Zed-$Architecture.exe" -BlobStoreKey "nightly/Zed-$Architecture.exe"
|
||||
UploadToBlobStore -BucketName $bucketName -FileToUpload "target/latest-sha" -BlobStoreKey "nightly/latest-sha-windows"
|
||||
|
||||
Remove-Item -Path $env:SETUP_PATH -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "target/latest-sha" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
default {
|
||||
Write-Error "Error: Unknown target '$target'"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
Remove-Item -Path "target/Zed-$Architecture.exe" -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "target/latest-sha" -ErrorAction SilentlyContinue
|
||||
|
||||
Reference in New Issue
Block a user