From bfebdb763544eaa636f9965ff3c9f3c4fe797935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Pilgaard=20Gr=C3=B8ndahl?= Date: Fri, 2 Sep 2022 21:27:20 +0200 Subject: [PATCH 1/2] updated ModListCreator default to latest --- settings.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 5af03874e203f1525ee8c357ac77799bf8634ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Pilgaard=20Gr=C3=B8ndahl?= Date: Fri, 2 Sep 2022 21:27:35 +0200 Subject: [PATCH 2/2] implemented searching for the filename specified in the settings.ps1 --- modpack-uploader.ps1 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 {