Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make download fix #49

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions tools/make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ $toolsPath = "$projectRoot\tools"
$buildPath = "$projectRoot\.build\@ONI Recon - Factions and Equipment"
$cachePath = "$projectRoot\.build\cache"
$modPrefix = "VS_ONI_C_"
$releasePage = "https://github.com/KoffeinFlummi/armake/releases"
$downloadPage = "https://github.com/KoffeinFlummi/armake/releases/download/v*.*.*/armake_v*.*.*.zip"
$downloadUrl = "https://github.com/KoffeinFlummi/armake/releases/download/v0.6.3/armake_v0.6.3.zip"
$armake2 = "$projectRoot\tools\armake2.exe"
$armake = "$projectRoot\tools\armake.exe"
$tag = git describe --tag | ForEach-Object {$_ -replace "-.*-", "-"}
Expand Down Expand Up @@ -182,26 +181,6 @@ function Get-InstalledArmakeVersion {
$version
}

function Get-LatestArmakeVersion {
$client = New-Object Net.WebClient
$content = $client.DownloadString($releasePage)
$client.dispose()

# Updated regex to match the latest version from the releases page
$versionMatches = [regex]::Matches($content, 'href="/KoffeinFlummi/armake/releases/download/v([\d\.]+)/armake_v[\d\.]+\.zip"')

if ($versionMatches.Count -eq 0) {
Write-Error -Message "[$timestamp] Failed to find valid armake download link."
return "0.0.0"
}

# Get the highest version number from the matches
$versions = $versionMatches | ForEach-Object { $_.Groups[1].Value }
$latestVersion = $versions | Sort-Object -Descending | Select-Object -First 1

return $latestVersion
}

function Update-Armake {
[CmdletBinding(SupportsShouldProcess=$True)]
param(
Expand Down Expand Up @@ -393,11 +372,11 @@ function Main {
}

$installed = Get-InstalledArmakeVersion
$latest = Get-LatestArmakeVersion
$latest = "0.6.3" # Hardcoded latest version

if (Compare-Version -version1 $latest -version2 $installed) {
Write-Output -InputObject "Found newer version of armake:" " Installed: $installed" " Latest: $latest"
Update-Armake -url ($downloadPage -f $latest)
Write-Output -InputObject ("Found newer version of armake: Installed: " + $installed + " Latest: " + $latest)
Update-Armake -url $downloadUrl
Write-Output -InputObject "Update complete, armake up-to-date."
}

Expand Down Expand Up @@ -433,4 +412,4 @@ function Main {

Copy-SupportFiles
}
Main
Main
Loading