mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-15 15:19:57 +00:00
Improve update procedure (#496)
* Improve update procedure * Change release procedure * Fix gh release * Fix release tag * Change release structure to support folders * Revert zip file changes to make them backwards compatible * Change path * Make launcher not contain the entire dependencies * Add downtime after API rate limit * Add rate limit checking before create release * Enumerate through rates * Adjust rate limit call * Change to create release as draft * Add update logic based on azure blobs * Fix publish * Create zip * Disable CD pipeline for prs * Increment version * Fix tests
This commit is contained in:
@@ -3,17 +3,36 @@ Param(
|
||||
[string]$version
|
||||
) #end param
|
||||
|
||||
function Get-FileMetadata {
|
||||
param (
|
||||
[string]$Path
|
||||
)
|
||||
|
||||
$fileInfo = Get-Item $Path
|
||||
|
||||
# Temporarily change current location to the folder path
|
||||
$currentLocation = Get-Location
|
||||
Set-Location -Path .\Publish
|
||||
$relativePath = Resolve-Path -Path $Path -Relative
|
||||
Set-Location -Path $currentLocation
|
||||
return @{
|
||||
Name = $fileInfo.Name
|
||||
Size = $fileInfo.Length
|
||||
RelativePath = $relativePath.trim(".\\")
|
||||
}
|
||||
}
|
||||
|
||||
$zipPath = "Publish\daybreakv$version.zip"
|
||||
Write-Output "Deleting pdb file"
|
||||
Remove-item .\Publish\Daybreak.pdb
|
||||
Remove-item .\Publish\Daybreak.Installer.pdb
|
||||
Remove-item .\Publish\Daybreak.7ZipExtractor.pdb
|
||||
Move-Item -Path .\Publish\Daybreak.Installer.exe -Destination .\Publish\Daybreak.Installer.Temp.exe
|
||||
$zipPath = "Publish\daybreakv$version.zip"
|
||||
Write-Output "Compressing binaries to $zipPath"
|
||||
|
||||
Compress-Archive .\Publish\* $zipPath -Force
|
||||
Write-Output "Cleaning up files"
|
||||
foreach ($file in Get-ChildItem -Path .\Publish -Exclude *.zip -Recurse -ErrorAction SilentlyContinue)
|
||||
{
|
||||
Write-Output "Removing $file"
|
||||
Remove-item $file -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
$files = Get-ChildItem -Path .\Publish -Recurse -File
|
||||
$metadata = $files | ForEach-Object { Get-FileMetadata $_.FullName }
|
||||
$json = $metadata | ConvertTo-Json
|
||||
$json | Out-File -FilePath ".\Publish\Metadata.json"
|
||||
Write-Host "Metadata written to .\Publish\Metadata.json"
|
||||
@@ -0,0 +1,20 @@
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$version,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$connectionString,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$sourcePath
|
||||
)
|
||||
|
||||
# Create a new blob container
|
||||
$containerName = "v$($version.ToLower().Replace('.', '-'))" # Container names must be lowercase
|
||||
Write-Host "Creating container $($containerName)"
|
||||
az storage container create --name $containerName --connection-string $connectionString
|
||||
|
||||
Write-Host "Uploading files"
|
||||
# Upload all files from the source path to the blob container
|
||||
az storage blob upload-batch --destination $containerName --source $sourcePath --connection-string $connectionString
|
||||
|
||||
Write-Host "Setting public access to container"
|
||||
az storage container set-permission --name $containerName --public-access blob --connection-string $connectionString
|
||||
Reference in New Issue
Block a user