Skip to content

Commit

Permalink
Merge pull request #30 from EnigmaticaModpacks/download-non-latest-mo…
Browse files Browse the repository at this point in the history
…dlistcreator-versions

Download non latest modlistcreator versions
  • Loading branch information
NielsPilgaard authored Sep 2, 2022
2 parents 131246e + 5af0387 commit a28deaf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions modpack-uploader.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a28deaf

Please sign in to comment.