testing release system

This commit is contained in:
Joey Eamigh
2023-06-21 17:15:18 -04:00
parent 89262da6d3
commit 03dca844cb
9 changed files with 182 additions and 25 deletions

17
client/README.md Normal file
View File

@@ -0,0 +1,17 @@
# FishPog Pixelmon Client
This tool makes sure the modpack is up to date, and downloads all of the mods.
## How to use
### Windows
```powershell
.\client.ps1
```
### Linux/Mac
```bash
./client.sh
```

35
client/client.ps1 Normal file → Executable file
View File

@@ -3,8 +3,9 @@ $winget = Get-Command winget -ErrorAction SilentlyContinue
if (!$winget) { if (!$winget) {
Write-Host "Error: winget is not installed." -Foreground Red Write-Host "Error: winget is not installed." -Foreground Red
Write-Host "This script may not work withotu winget." -Foreground Red Write-Host "This script probably will not work without winget." -Foreground Red
Write-Host "Run 'Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe' in an admin powershell prompt to install winget." -Foreground Red Write-Host "Run 'Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe' in to install winget." -Foreground Red
Write-Host "If you do install winget, this script should handle the rest." -Foreground Red
} }
# Check that python is installed # Check that python is installed
@@ -36,11 +37,33 @@ if (-not (Get-Command "java" -ErrorAction SilentlyContinue)) {
} }
# Check that git is installed
if (-not (Get-Command "git" -ErrorAction SilentlyContinue)) {
Write-Host "Error: git is not installed." -Foreground Red
if ($winget) {
Write-Host "Attempting to install git."
winget install --id Git.Git -e --source winget
}
else {
Write-Host "Please install git to continue." -Foreground Red
exit 1
}
}
# Check that multimc is installed
if (-not (Get-Command "multimc" -ErrorAction SilentlyContinue)) {
Write-Host "Error: multimc is not installed." -Foreground Red
Write-Host "Please install multimc to continue." -Foreground Red
exit 1
}
if (Test-Path ".venv") { } else { python -m venv .venv } if (Test-Path ".venv") { } else { python -m venv .venv }
.venv\Scripts\Activate . ./.venv/bin/Activate.ps1
python -m pip install --upgrade pip (python -m pip install --upgrade pip) | Out-Null
python -m pip install -r requirements.txt (python -m pip install -r requirements.txt) | Out-Null
python .\client.py python client.py

View File

@@ -1,3 +1,52 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
DOWNLOADER_URL = "https://github.com/North-West-Wind/CurseForge-CLI/releases/latest/download/curseforge.zip" from termcolor import cprint
MOD_DOWNLOADER_URL = "https://github.com/North-West-Wind/CurseForge-CLI/releases/latest/download/curseforge.zip"
REPO_URL = "https://git.233hfd.com/joey/FishPogPixelmon"
# main
def __main__():
header()
warning()
# info
def warning():
cprint(
"This updater may remove your singleplayer worlds. Please use a different instance for singleplayer.", "yellow"
)
if input("Continue? [Y/n] ").lower() == "n":
exit()
else:
print("")
# ascii art lol
def header():
cprint(
"""
_______ __ __ _______
| _ ||__|.-----.| |--.| _ |.-----..-----.
|. 1___|| ||__ --|| ||. 1 || _ || _ |
|. __) |__||_____||__|__||. ____||_____||___ |
|: | |: | |_____|
|::.| |::.|
`---' `---'
_______ __ __
| _ ||__|.--.--..-----.| |.--------..-----..-----.
|. 1 || ||_ _|| -__|| || || _ || |
|. ____||__||__.__||_____||__||__|__|__||_____||__|__|
|: |
|::.|
`---'
""",
"green",
)
# run app
__main__()

20
client/client.sh Normal file → Executable file
View File

@@ -12,11 +12,23 @@ if ! [ -x "$(command -v java)" ]; then
exit 1 exit 1
fi fi
if [ -d .venv ]; then; else python -m venv .venv; fi # check that git is installed
if ! [ -x "$(command -v git)" ]; then
echo 'Error: git is not installed. Please install it to continue.' >&2
exit 1
fi
source .venv/bin/activate # check that git is installed
if ! [ -x "$(command -v multimc)" ]; then
echo 'Error: multimc is not installed. Please install it to continue.' >&2
exit 1
fi
python -m pip install --upgrade pip if ! [ -d .venv ]; then python -m venv .venv; fi
python -m pip install -r requirements.txt
source .venv/bin/activate &>/dev/null
python -m pip install --upgrade pip &>/dev/null
python -m pip install -r requirements.txt &>/dev/null
python ./client.py python ./client.py

View File

@@ -1,5 +1,9 @@
certifi==2023.5.7 certifi==2023.5.7
charset-normalizer==3.1.0 charset-normalizer==3.1.0
gitdb==4.0.10
GitPython==3.1.31
idna==3.4 idna==3.4
requests==2.31.0 requests==2.31.0
smmap==5.0.0
termcolor==2.3.0
urllib3==2.0.3 urllib3==2.0.3

View File

@@ -1,5 +0,0 @@
certifi==2023.5.7
charset-normalizer==3.1.0
idna==3.4
requests==2.31.0
urllib3==2.0.3

View File

@@ -1,11 +1,13 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os, sys, argparse, tempfile, subprocess, shutil, requests import os, sys, argparse, tempfile, subprocess, shutil, requests
from git.repo import Repo
from termcolor import cprint
parser = argparse.ArgumentParser(description="a helper script for liightninggod modpacks") parser = argparse.ArgumentParser(description="a helper script for liightninggod modpacks")
parser.add_argument("--export", "-e", help="export modpack zip", action="store_true") parser.add_argument("--export", "-e", help="export modpack zip", action="store_true")
parser.add_argument("--export-full", help="export modpack zip with mods folder", action="store_true") parser.add_argument("--release", "-r", help="release modpack version", action="store_true")
parser.add_argument("--setup", "-s", help="setup project and install dependencies", action="store_true") parser.add_argument("--setup", "-s", help="setup project and install dependencies", action="store_true")
parser.add_argument("--force", "-f", help="forces things when needed, like redoing setup", action="store_true") parser.add_argument("--force", "-f", help="forces things when needed, like redoing setup", action="store_true")
parser.add_argument("--build-pax", help="builds pax from source, even if on a supported platform", action="store_true") parser.add_argument("--build-pax", help="builds pax from source, even if on a supported platform", action="store_true")
@@ -18,6 +20,9 @@ PAX_LATEST_RELEASE = f"{PAX_GITHUB}/releases/latest/download"
PAX_LINUX = f"{PAX_LATEST_RELEASE}/pax" PAX_LINUX = f"{PAX_LATEST_RELEASE}/pax"
PAX_WINDOWS = f"{PAX_LATEST_RELEASE}/pax-windows.zip" PAX_WINDOWS = f"{PAX_LATEST_RELEASE}/pax-windows.zip"
MODPACK_GITHUB = "https://git.233hfd.com/joey/FishPogPixelmon"
MODPACK_RELEASES_URL = "https://git.233hfd.com/api/v1/repos/joey/FishPogPixelmon/releases"
OS = sys.platform OS = sys.platform
@@ -29,6 +34,10 @@ def __main__():
return return
elif args.export: elif args.export:
print("exporting modpack") print("exporting modpack")
export_pack()
return
elif args.release:
release()
return return
print( print(
@@ -36,10 +45,48 @@ def __main__():
) )
# setup
def setup_pack(): def setup_pack():
pax() pax()
# release
def release():
print("releasing modpack")
if not command_exists("tea"):
cprint("gitea cli is not installed - make sure it is installed for your platform", "red")
exit(1)
repo = Repo(WORKING_DIR)
if repo.is_dirty():
cprint("repo is dirty - commit changes before releasing", "red")
exit(1)
export_pack()
print("enter the version number for this release")
print(f"the last release was: {most_recent_release()}")
version = input("version: v")
subprocess.run(
[
"tea",
"release",
"create",
"-a",
".out/FishPog Pixelmon.zip",
f"v{version}",
]
)
# export
def export_pack():
subprocess.run(["./pax", "export"])
os.rename(".out/FishPog Pixelmon.zip", ".out/FishPog Pixelmon.zip")
# pax # pax
def pax(): def pax():
if os.path.isfile(os.path.join(WORKING_DIR, "pax")) and not args.force: if os.path.isfile(os.path.join(WORKING_DIR, "pax")) and not args.force:
@@ -70,12 +117,12 @@ def pax():
def pax_from_source(): def pax_from_source():
if OS == "windows": if OS == "windows":
print("building from source not supported on windows yet") cprint("building from source not supported on windows yet", "red")
os._exit(1) exit(1)
if not command_exists("nimble"): if not command_exists("nimble"):
print("nim is not installed - make sure it is installed for your platform") cprint("nim is not installed - make sure it is installed for your platform", "red")
os._exit(1) exit(1)
TMP = tempfile.mkdtemp() TMP = tempfile.mkdtemp()
os.chdir(TMP) os.chdir(TMP)
@@ -87,6 +134,15 @@ def pax_from_source():
subprocess.run(["cp", "pax", WORKING_DIR]) subprocess.run(["cp", "pax", WORKING_DIR])
# git
def most_recent_release() -> str:
r = requests.get(MODPACK_RELEASES_URL)
releases: list[dict] = r.json()
if len(releases) == 0:
return "none"
return releases[0]["tag_name"]
# helper functions # helper functions
def command_exists(binary_name): def command_exists(binary_name):
return shutil.which(binary_name) is not None return shutil.which(binary_name) is not None

View File

@@ -1,7 +1,8 @@
# Check for python3 or python # Check for python3 or python
if (Get-Command "python3") { if (Get-Command "python3") {
$python = "python3" $python = "python3"
} else { }
else {
$python = "python" $python = "python"
} }
@@ -15,4 +16,4 @@ if (-Not (Test-Path "./.venv")) {
# Install required packages # Install required packages
& $python -m pip install --upgrade pip & $python -m pip install --upgrade pip
& $python -m pip install -r requirements.txt & $python -m pip install -r client/requirements.txt

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
if command -v python3 &> /dev/null; then if command -v python3 &>/dev/null; then
python="python3" python="python3"
else else
python="python" python="python"
@@ -12,4 +12,4 @@ $python -m venv .venv
source .venv/bin/activate source .venv/bin/activate
$python -m pip install --upgrade pip $python -m pip install --upgrade pip
$python -m pip install -r requirements.txt $python -m pip install -r client/requirements.txt