From 100404e4d9b9202baa061dd3a7a6ae8fee5aeb77 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 23 Sep 2018 03:23:09 -0400 Subject: [PATCH] Add TGS4 PreSynchronize (Changelog compile) scripts (#40356) TGS4 does not have changelog shitcode TGS4 does not have changelog shitcode TGS4 does not have changelog shitcode TGS4 does not have changelog shitcode TGS4 does not have changelog shitcode TGS4 does not have changelog shitcode --- tools/tgs4_scripts/PreSynchronize.bat | 3 +++ tools/tgs4_scripts/PreSynchronize.ps1 | 31 ++++++++++++++++++++++ tools/tgs4_scripts/PreSynchronize.sh | 37 +++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 tools/tgs4_scripts/PreSynchronize.bat create mode 100644 tools/tgs4_scripts/PreSynchronize.ps1 create mode 100755 tools/tgs4_scripts/PreSynchronize.sh diff --git a/tools/tgs4_scripts/PreSynchronize.bat b/tools/tgs4_scripts/PreSynchronize.bat new file mode 100644 index 0000000000000..3ba7cfde4843f --- /dev/null +++ b/tools/tgs4_scripts/PreSynchronize.bat @@ -0,0 +1,3 @@ +@echo off + +powershell -NoProfile -ExecutionPolicy Bypass -File PreSynchronize.ps1 -game_path %1 diff --git a/tools/tgs4_scripts/PreSynchronize.ps1 b/tools/tgs4_scripts/PreSynchronize.ps1 new file mode 100644 index 0000000000000..cf5a27d0a0c5b --- /dev/null +++ b/tools/tgs4_scripts/PreSynchronize.ps1 @@ -0,0 +1,31 @@ +param( + $game_path +) + +cd $game_path + +Write-Host "Installing pip dependencies..." +pip3 install PyYaml beautifulsoup4 +if(!$?){ + Write-Host "pip3 returned non-zero!" + exit $LASTEXITCODE +} + +Write-Host "Running changelog script..." +python3 tools/ss13_genchangelog.py html/changelog.html html/changelogs +if(!$?){ + Write-Host "python3 returned non-zero!" + exit $LASTEXITCODE +} + +Write-Host "Committing changes..." +git add html + +if(!$?){ + Write-Host "`git add` returned non-zero!" + exit $LASTEXITCODE +} + +#we now don't care about failures +git commit -m "Automatic changelog compile, [ci skip]" +exit 0 diff --git a/tools/tgs4_scripts/PreSynchronize.sh b/tools/tgs4_scripts/PreSynchronize.sh new file mode 100755 index 0000000000000..bf57d8a0bea28 --- /dev/null +++ b/tools/tgs4_scripts/PreSynchronize.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +has_python="$(command -v python3)" +has_git="$(command -v git)" +has_sudo="$(command -v sudo)" +has_pip="$(command -v pip3)" + +set -e + +if ! { [ -x "$has_python" ] && [ -x "$has_pip" ] && [ -x "$has_git" ]; }; then + echo "Installing apt dependencies..." + if ! [ -x "$has_sudo" ]; then + apt update + apt install -y python3 python3-pip git + rm -rf /var/lib/apt/lists/* + else + sudo apt update + sudo apt install -y python3 python3-pip git + sudo rm -rf /var/lib/apt/lists/* + fi +fi + +echo "Installing pip dependencies..." +pip3 install PyYaml beautifulsoup4 + +cd $1 + +echo "Running changelog script..." +python3 tools/ss13_genchangelog.py html/changelog.html html/changelogs + +echo "Committing changes..." +git add html + +#we now don't care about failures +set +e +git commit -m "Automatic changelog compile, [ci skip]" +exit 0