Files
Daybreak/Scripts/BuildRelease.ps1
T
amacocian b1a7d3a111 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
2023-11-22 21:13:01 +01:00

38 lines
1.1 KiB
PowerShell

Param(
[Parameter(Mandatory=$true)]
[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
Compress-Archive .\Publish\* $zipPath -Force
$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"