upload-nightly.ps1

 1[CmdletBinding()]
 2Param(
 3    [Parameter()][string]$Architecture
 4)
 5
 6# Based on the template in: https://docs.digitalocean.com/reference/api/spaces-api/
 7$ErrorActionPreference = "Stop"
 8. "$PSScriptRoot\lib\blob-store.ps1"
 9. "$PSScriptRoot\lib\workspace.ps1"
10
11ParseZedWorkspace
12Write-Host "Uploading nightly for target: $target"
13
14$bucketName = "zed-nightly-host"
15$releaseVersion = & "$PSScriptRoot\get-crate-version.ps1" zed
16$version = "$releaseVersion-$env:GITHUB_RUN_NUMBER+$env:GITHUB_SHA"
17
18# TODO:
19# Upload remote server files
20# $remoteServerFiles = Get-ChildItem -Path "target" -Filter "zed-remote-server-*.gz" -Recurse -File
21# foreach ($file in $remoteServerFiles) {
22#     Upload-ToBlobStore -BucketName $bucketName -FileToUpload $file.FullName -BlobStoreKey "nightly/$($file.Name)"
23#     Remove-Item -Path $file.FullName
24# }
25
26UploadToBlobStore -BucketName $bucketName -FileToUpload "target/Zed-$Architecture.exe" -BlobStoreKey "nightly/Zed-$Architecture.exe"
27UploadToBlobStore -BucketName $bucketName -FileToUpload "target/Zed-$Architecture.exe" -BlobStoreKey "$version/Zed-$Architecture.exe"
28
29Remove-Item -Path "target/Zed-$Architecture.exe" -ErrorAction SilentlyContinue
30
31$version | Out-File -FilePath "target/latest-sha" -NoNewline
32UploadToBlobStore -BucketName $bucketName -FileToUpload "target/latest-sha" -BlobStoreKey "nightly/latest-sha-windows"
33Remove-Item -Path "target/latest-sha" -ErrorAction SilentlyContinue