diff --git a/modpack-uploader.ps1 b/modpack-uploader.ps1 index 1090788..3e0488a 100644 --- a/modpack-uploader.ps1 +++ b/modpack-uploader.ps1 @@ -27,15 +27,21 @@ function Get-GitHubRelease { $file ) - $releases = "https://api.github.com/repos/$repo/releases" + $response = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases" - Write-Host "Determining latest release of $repo" - $tag = (Invoke-WebRequest -Uri $releases -UseBasicParsing | ConvertFrom-Json)[0].tag_name + $matchingRelease = $response.assets -match $file + if ($matchingRelease) { + $downloadUrl = $matchingRelease.browser_download_url + + Remove-Item $file -ErrorAction SilentlyContinue - $download = "https://github.com/$repo/releases/download/$tag/$file" + Write-Host "Dowloading $file..." - Write-Host "Dowloading..." - Invoke-WebRequest $download -Out $file + Invoke-RestMethod $downloadUrl -Out $file + } + else { + Write-Error "Found no files matching '$file' in the repository '$repo'" + } } function Test-ForDependencies { diff --git a/settings.ps1 b/settings.ps1 index d22026a..d7b69aa 100644 --- a/settings.ps1 +++ b/settings.ps1 @@ -72,10 +72,10 @@ $CLIENT_RELEASE_TYPE = "beta" #=====================================================================// # File name of the latest https://github.com/ModdingX/ModListCreator/releases -$CHANGELOG_GENERATOR_JAR = "ModListCreator-4.0.1-fatjar.jar" +$CHANGELOG_GENERATOR_JAR = "ModListCreator-4.0.2-fatjar.jar" # File name of the latest https://github.com/ModdingX/ModListCreator/releases -$MODLIST_CREATOR_JAR = "ModListCreator-4.0.1-fatjar.jar" +$MODLIST_CREATOR_JAR = "ModListCreator-4.0.2-fatjar.jar" #=====================================================================// # CLIENT FILE SETTINGS