Skip to content

Commit

Permalink
Merge pull request #27 from EnigmaticaModpacks/modlistcreator-changelogs
Browse files Browse the repository at this point in the history
Mod Changelogs through ModlistCreator
  • Loading branch information
NielsPilgaard committed Aug 14, 2022
2 parents e310982 + 8538bcf commit 9d73374
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 34 deletions.
51 changes: 21 additions & 30 deletions modpack-uploader.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -187,24 +187,19 @@ function New-Changelog {
) {
if (-not (Test-Path $CHANGELOG_GENERATOR_JAR) -or $ENABLE_ALWAYS_UPDATE_JARS) {
Remove-Item $CHANGELOG_GENERATOR_JAR -Recurse -Force -ErrorAction SilentlyContinue
Get-GitHubRelease -repo "TheRandomLabs/ChangelogGenerator" -file $CHANGELOG_GENERATOR_JAR
Get-GitHubRelease -repo "ModdingX/ModListCreator" -file $CHANGELOG_GENERATOR_JAR
}
$changelogFile = "changelog.md"
Remove-Item $changelogFile -ErrorAction SilentlyContinue

Write-Host
Write-Host "Generating mod changelog..." -ForegroundColor Cyan
Write-Host

java -jar $CHANGELOG_GENERATOR_JAR `
--markdown `
--lines=50 `
--entries=1 `
--new="$CLIENT_ZIP_NAME.zip" `
--old="$LAST_MODPACK_ZIP_NAME.zip"

Remove-Item $CHANGELOG_PATH -ErrorAction SilentlyContinue
Move-Item -Path $changelogFile -Destination $CHANGELOG_PATH

java -jar $CHANGELOG_GENERATOR_JAR `
changelog `
--output $CHANGELOG_PATH `
--new "$CLIENT_ZIP_NAME.zip" `
--old "$LAST_MODPACK_ZIP_NAME.zip"

Write-Host "Mod changelog generated!" -ForegroundColor Green
}
Expand All @@ -217,8 +212,8 @@ function Push-ClientFiles {
Remove-BlacklistedFiles
}

#$CLIENT_CHANGELOG = Get-Content -Path "$PSScriptRoot/../changelogs/changelog.md"

# This ugly json seems to be a necessity,
# I have yet to get @{} and ConvertTo-Json to work with the CurseForge Upload API
$CLIENT_METADATA =
"{
changelog: `'$CLIENT_CHANGELOG`',
Expand Down Expand Up @@ -253,16 +248,15 @@ function Push-ClientFiles {
Write-Host "Failed to upload client files: $response" -ForegroundColor Red
throw "Failed to upload client files: $response"
}
else {
Write-Host
Write-Host "Uploaded modpack!" -ForegroundColor Green
Write-Host
Write-Host "Return Id: $clientFileReturnId" -ForegroundColor Cyan
Write-Host

if ($ENABLE_SERVERSTARTER_MODULE) {
Update-FileLinkInServerFiles -ClientFileReturnId $clientFileReturnId
}

Write-Host
Write-Host "Uploaded modpack!" -ForegroundColor Green
Write-Host
Write-Host "Return Id: $clientFileReturnId" -ForegroundColor Cyan
Write-Host

if ($ENABLE_SERVERSTARTER_MODULE) {
Update-FileLinkInServerFiles -ClientFileReturnId $clientFileReturnId
}
}
}
Expand Down Expand Up @@ -380,15 +374,12 @@ function Update-Modlist {
if ($ENABLE_MODLIST_CREATOR_MODULE) {
if (-not (Test-Path $MODLIST_CREATOR_JAR) -or $ENABLE_ALWAYS_UPDATE_JARS) {
Remove-Item $MODLIST_CREATOR_JAR -Recurse -Force -ErrorAction SilentlyContinue
Get-GitHubRelease -repo "MelanX/ModListCreator" -file $MODLIST_CREATOR_JAR
Get-GitHubRelease -repo "ModdingX/ModListCreator" -file $MODLIST_CREATOR_JAR
}

Remove-Item $MODLIST_PATH -ErrorAction SilentlyContinue
java -jar $MODLIST_CREATOR_JAR --markdown --output "./" --detailed --manifest "$CLIENT_ZIP_NAME.zip"
Copy-Item -Path "MODLIST.md" -Destination $MODLIST_PATH -ErrorAction SilentlyContinue
Move-Item -Path "MODLIST.md" -Destination "MODLIST.md" -ErrorAction SilentlyContinue -Force
Copy-Item -Path "automation/MODLIST.md" -Destination $MODLIST_PATH -ErrorAction SilentlyContinue
Move-Item -Path "automation/MODLIST.md" -Destination "MODLIST.md" -ErrorAction SilentlyContinue -Force
java -jar $MODLIST_CREATOR_JAR modlist --output $MODLIST_PATH --detailed "$CLIENT_ZIP_NAME.zip"
Copy-Item -Path $MODLIST_PATH -Destination "$INSTANCE_ROOT/MODLIST.md"
}
}

Expand Down
8 changes: 4 additions & 4 deletions settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ $CLIENT_RELEASE_TYPE = "beta"
# DEPENDENCIES
#=====================================================================//

# File name of the latest https://github.com/TheRandomLabs/ChangelogGenerator/releases
$CHANGELOG_GENERATOR_JAR = "ChangelogGenerator-2.0.0-pre10.jar"
# File name of the latest https://github.com/ModdingX/ModListCreator/releases
$CHANGELOG_GENERATOR_JAR = "ModListCreator-4.0.1-fatjar.jar"

# File name of the latest https://github.com/MelanX/ModListCreator/releases
$MODLIST_CREATOR_JAR = "ModListCreator-2.0.1.jar"
# File name of the latest https://github.com/ModdingX/ModListCreator/releases
$MODLIST_CREATOR_JAR = "ModListCreator-4.0.1-fatjar.jar"

#=====================================================================//
# CLIENT FILE SETTINGS
Expand Down

0 comments on commit 9d73374

Please sign in to comment.