% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 1712 100 1712 0 0 5510 0 --:--:-- --:--:-- --:--:-- 5522 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 35147 100 35147 0 0 188k 0 --:--:-- --:--:-- --:--:-- 188k % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 247 100 247 0 0 1179 0 --:--:-- --:--:-- --:--:-- 1187 compressed data: 6703104 to 2922358 Successfully packaged file compressed data: 6067200 to 2643195 Successfully packaged file compressed data: 7844544 to 3317678 Successfully packaged file Done packaging update files Done packing Linux version Done packing Windows versions Done moving files to web directory Done updating changelogs Errors and uncaught output from package.sh: set -e + set -e success=0 + success=0 on_exit() { if [[ $success -eq 0 ]]; then outputFolder="https://starcatcher.us/TPT/$webDirectory/Output" if [[ $vanillaRelease -eq 1 ]]; then outputFolder="https://starcatcher.us/TPT/$webDirectory/" fi echo "msg #powder-dev Package script failed, details at $outputFolder" | $packDirectory/nc.exe -w 1 localhost 9876 fi } trap on_exit 0 + trap on_exit 0 pushd `dirname $0` >/dev/null ++ dirname 'C:\Starcatcher\Github-Action-Releases\updatepackager\package.sh' + pushd 'C:\Starcatcher\Github-Action-Releases\updatepackager' packDirectory=$PWD + packDirectory=/c/Starcatcher/Github-Action-Releases/updatepackager workingDirectory=$1 + workingDirectory=D:/TPT-releases/mods/TPT-Record-Mod/ releaseType=$2 + releaseType=stable packageName=$3 + packageName=TPT-Record-Mod webDirectory=$4 + webDirectory=mods/TPT-Record-Mod githubUrl=$5 + githubUrl=catsoften/TPT-Record-Mod githubBranch=$6 + githubBranch=master versionNum=$7 + versionNum=3.1 buildId=$8 + buildId=4 commitSha=$9 + commitSha=d36961609b385997faa56a60929a2d147f8b22bf win64=${10} + win64=powder-v3.1.4-x86_64-win-msvc-static.exe win32=${11} + win32=powder-v3.1.4-i686-win-msvc-static.exe mac=${12} + mac=powder-v3.1.4-x86_64-mac-gcc-static.dmg macArm=${13} + macArm=powder-v3.1.4-arm64-mac-gcc-static.dmg lin64=${14} + lin64=powder-v3.1.4-x86_64-lin-gcc-static if [[ $packageName == "powder" || $packageName == "powder-beta" ]]; then vanillaRelease=1 else vanillaRelease=0 fi + [[ TPT-Record-Mod == \p\o\w\d\e\r ]] + [[ TPT-Record-Mod == \p\o\w\d\e\r\-\b\e\t\a ]] + vanillaRelease=0 if [[ $releaseType == "snapshot" ]]; then fullVersionNum="Snapshot $buildId" else fullVersionNum="$versionNum (build $buildId)" fi + [[ stable == \s\n\a\p\s\h\o\t ]] + fullVersionNum='3.1 (build 4)' if [[ ! -d $workingDirectory ]]; then echo "Working directory does not exist" exit 1 fi + [[ ! -d D:/TPT-releases/mods/TPT-Record-Mod/ ]] if [[ ! -d /c/StarHTTP/TPT/$webDirectory ]]; then if [[ $vanillaRelease -eq 1 ]]; then # Vanilla releases use a different folder per build id, create it automatically mkdir /c/StarHTTP/TPT/"$webDirectory" else echo "Web directory does not exist" exit 1 fi fi + [[ ! -d /c/StarHTTP/TPT/mods/TPT-Record-Mod ]] pushd $workingDirectory >/dev/null + pushd D:/TPT-releases/mods/TPT-Record-Mod/ has_mac_arm=0 + has_mac_arm=0 if [[ -f "$macArm" ]]; then has_mac_arm=1 fi + [[ -f powder-v3.1.4-arm64-mac-gcc-static.dmg ]] + has_mac_arm=1 # Android builds not supported right now rm -f *.apk + rm -f '*.apk' rm -rf binaryArchive + rm -rf binaryArchive mkdir binaryArchive + mkdir binaryArchive cp $win64 $win32 $mac $lin64 binaryArchive + cp powder-v3.1.4-x86_64-win-msvc-static.exe powder-v3.1.4-i686-win-msvc-static.exe powder-v3.1.4-x86_64-mac-gcc-static.dmg powder-v3.1.4-x86_64-lin-gcc-static binaryArchive if [[ $has_mac_arm -eq 1 ]]; then cp $macArm binaryArchive fi + [[ 1 -eq 1 ]] + cp powder-v3.1.4-arm64-mac-gcc-static.dmg binaryArchive curl https://raw.githubusercontent.com/$githubUrl/$githubBranch/README.md -o README.md 2>>package-output.txt + curl https://raw.githubusercontent.com/catsoften/TPT-Record-Mod/master/README.md -o README.md curl https://raw.githubusercontent.com/$githubUrl/$githubBranch/LICENSE -o LICENSE 2>>package-output.txt + curl https://raw.githubusercontent.com/catsoften/TPT-Record-Mod/master/LICENSE -o LICENSE # Download or generate changelog.txt if [[ $releaseType == "stable" || $releaseType == "beta" ]]; then if [[ ! $vanillaRelease -eq 1 ]]; then if [[ -f changelog.txt ]]; then mv changelog.txt changelog-old.txt fi curl https://raw.githubusercontent.com/$githubUrl/$githubBranch/changelog.txt -o changelog.txt 2>>package-output.txt if [[ -f changelog-old.txt ]]; then if diff -q changelog.txt changelog-old.txt >/dev/null; then echo "Please update changelog.txt before releasing a build on the Starcatcher update server." rm changelog-old.txt exit 1 fi rm changelog-old.txt fi fi elif [[ $releaseType == "snapshot" ]]; then # Snapshots curl https://api.github.com/repos/The-Powder-Toy/The-Powder-Toy/commits >commits.json 2>>package-output.txt python $packDirectory/parsecommits.py $(cat /c/StarHTTP/TPT/"$webDirectory"/Output/latest_commit.log) rm commits.json else echo "Only stable and snapshot release types supported" exit 1 fi + [[ stable == \s\t\a\b\l\e ]] + [[ ! 0 -eq 1 ]] + [[ -f changelog.txt ]] + mv changelog.txt changelog-old.txt + curl https://raw.githubusercontent.com/catsoften/TPT-Record-Mod/master/changelog.txt -o changelog.txt + [[ -f changelog-old.txt ]] + diff -q changelog.txt changelog-old.txt + rm changelog-old.txt # Package files for usage in-game $packDirectory/packager.exe "$win64" WIN64.ptu >>package-output.txt + /c/Starcatcher/Github-Action-Releases/updatepackager/packager.exe powder-v3.1.4-x86_64-win-msvc-static.exe WIN64.ptu $packDirectory/packager.exe "$win32" WIN32.ptu >>package-output.txt + /c/Starcatcher/Github-Action-Releases/updatepackager/packager.exe powder-v3.1.4-i686-win-msvc-static.exe WIN32.ptu #$packDirectory/packager.exe "$mac" MACOS.ptu >>package-output.txt #if [[ $has_mac_arm -eq 1 ]]; then # $packDirectory/packager.exe "$macArm" MACOSARM.ptu >>package-output.txt #fi $packDirectory/packager.exe "$lin64" LIN64.ptu >>package-output.txt + /c/Starcatcher/Github-Action-Releases/updatepackager/packager.exe powder-v3.1.4-x86_64-lin-gcc-static LIN64.ptu echo "Done packaging update files" >>package-output.txt + echo 'Done packaging update files' # Linux 64 bit mv "$lin64" powder + mv powder-v3.1.4-x86_64-lin-gcc-static powder python $packDirectory/zip.py "$packageName" linux64 + python /c/Starcatcher/Github-Action-Releases/updatepackager/zip.py TPT-Record-Mod linux64 rm powder + rm powder echo "Done packing Linux version" >>package-output.txt + echo 'Done packing Linux version' # Mac OS macAppFolderIn= + macAppFolderIn= macAppFolder= + macAppFolder= if [[ $packageName == "Snapshot" ]]; then macAppFolderIn="Powder Snapshot.app" macAppFolderOut=$macAppFolderIn macAppFolderM1Out="Powder Snapshot M1.app" macDmgOut="Snapshot.dmg" macDmgM1Out="Snapshot M1.dmg" elif [[ $packageName == "powder" ]]; then macAppFolderIn=Powder.app macAppFolderOut=$macAppFolderIn macAppFolderM1Out="Powder M1.app" macDmgOut="Powder.dmg" macDmgM1Out="Powder M1.dmg" else macAppFolderIn="Powder mods.app" macAppFolderOut="$packageName.app" macAppFolderM1Out="$packageName M1.app" macDmgOut="$packageName.dmg" macDmgM1Out="$packageName M1.dmg" fi + [[ TPT-Record-Mod == \S\n\a\p\s\h\o\t ]] + [[ TPT-Record-Mod == \p\o\w\d\e\r ]] + macAppFolderIn='Powder mods.app' + macAppFolderOut=TPT-Record-Mod.app + macAppFolderM1Out='TPT-Record-Mod M1.app' + macDmgOut=TPT-Record-Mod.dmg + macDmgM1Out='TPT-Record-Mod M1.dmg' test -d $packDirectory/"$macAppFolderIn" + test -d '/c/Starcatcher/Github-Action-Releases/updatepackager/Powder mods.app' pack_mac() { local filename=$1 local appFolderIn=$2 local appFolderOut=$3 local dmgOut=$4 mv "$filename" powder-x #$packDirectory/rcodesign sign --pem-source $packDirectory/macsigningkey.crt --code-signature-flags runtime --team-name "The Powder Toy" powder-x mkdir MacDMG cp -r $packDirectory/"$appFolderIn" MacDMG/"$appFolderOut" cp powder-x MacDMG/"$appFolderOut"/Contents/MacOS cp README.md MacDMG cp LICENSE MacDMG sed -i -e "s/MAJOR_VERSION/$versionNum/" MacDMG/"$appFolderOut"/Contents/Info.plist sed -i -e "s/FULL_VERSION/$fullVersionNum/" MacDMG/"$appFolderOut"/Contents/Info.plist #$packDirectory/rcodesign sign --pem-source $packDirectory/macsigningkey.crt --code-signature-flags runtime --team-name "The Powder Toy" MacDMG/"$appFolderOut"/ #/c/Starcatcher/Ubuntu2/ubuntu2004.exe run genisoimage -D -V "The-Powder-Toy Snapshots" -no-pad -r -apple -o powder-osx-uncompressed.dmg "MacDMG" >/d/test22.txt 2>&1 #/c/Starcatcher/Ubuntu2/ubuntu2004.exe run dmg dmg powder-osx-uncompressed.dmg Snapshot.dmg >/d/test3.txt 2>&1 echo "dmg $appFolderOut $workingDirectory $dmgOut" | $packDirectory/nc.exe -w 5 localhost 9876 >>package-output.txt rm -r MacDMG powder-osx-uncompressed.dmg powder-x #$packDirectory/rcodesign sign --pem-source $packDirectory/macsigningkey.crt --code-signature-flags runtime --team-name "The Powder Toy" "$dmgOut" #$packDirectory/rcodesign notarize --api-issuer 68911d4c-110c-4172-b9f7-b7efa30f9680 --api-key DEADBEEF "$dmgOut" } if [[ "$mac" == *.dmg ]]; then mv "$mac" "$macDmgOut" if [[ $has_mac_arm -eq 1 ]]; then mv "$macArm" "$macDmgM1Out" fi else pack_mac "$mac" "$macAppFolderIn" "$macAppFolderOut" "$macDmgOut" if [[ $has_mac_arm -eq 1 ]]; then pack_mac "$macArm" "$macAppFolderIn" "$macAppFolderM1Out" "$macDmgM1Out" fi fi + [[ powder-v3.1.4-x86_64-mac-gcc-static.dmg == *.dmg ]] + mv powder-v3.1.4-x86_64-mac-gcc-static.dmg TPT-Record-Mod.dmg + [[ 1 -eq 1 ]] + mv powder-v3.1.4-arm64-mac-gcc-static.dmg 'TPT-Record-Mod M1.dmg' # Windows 64 and 32 bit mv "$win64" Powder.exe + mv powder-v3.1.4-x86_64-win-msvc-static.exe Powder.exe mv "$win32" Powder32.exe + mv powder-v3.1.4-i686-win-msvc-static.exe Powder32.exe mv README.md readme.txt + mv README.md readme.txt mv LICENSE license.txt + mv LICENSE license.txt python $packDirectory/zip.py "$packageName" win64 + python /c/Starcatcher/Github-Action-Releases/updatepackager/zip.py TPT-Record-Mod win64 python $packDirectory/zip.py "$packageName" win32 + python /c/Starcatcher/Github-Action-Releases/updatepackager/zip.py TPT-Record-Mod win32 rm Powder.exe Powder32.exe + rm Powder.exe Powder32.exe rm readme.txt license.txt + rm readme.txt license.txt echo "Done packing Windows versions" >>package-output.txt + echo 'Done packing Windows versions' # Move files into appropriate directories on server # Note: This relies on Window's case-insensitive filenames for official releases mv WIN64.ptu WIN32.ptu LIN64.ptu /c/StarHTTP/TPT/"$webDirectory" + mv WIN64.ptu WIN32.ptu LIN64.ptu /c/StarHTTP/TPT/mods/TPT-Record-Mod if [[ ! $vanillaRelease -eq 1 ]]; then # For everything but vanilla releases, copy into Output/ and Older/ folders cp "$packageName.zip" "/c/StarHTTP/TPT/$webDirectory/Older/$packageName $buildId.zip" cp "$packageName win32.zip" "/c/StarHTTP/TPT/$webDirectory/Older/$packageName $buildId win32.zip" cp "$packageName.dmg" "/c/StarHTTP/TPT/$webDirectory/Older/$packageName $buildId.dmg" cp "$packageName linux64.zip" "/c/StarHTTP/TPT/$webDirectory/Older/$packageName $buildId linux64.zip" fi + [[ ! 0 -eq 1 ]] + cp TPT-Record-Mod.zip '/c/StarHTTP/TPT/mods/TPT-Record-Mod/Older/TPT-Record-Mod 4.zip' + cp 'TPT-Record-Mod win32.zip' '/c/StarHTTP/TPT/mods/TPT-Record-Mod/Older/TPT-Record-Mod 4 win32.zip' + cp TPT-Record-Mod.dmg '/c/StarHTTP/TPT/mods/TPT-Record-Mod/Older/TPT-Record-Mod 4.dmg' + cp 'TPT-Record-Mod linux64.zip' '/c/StarHTTP/TPT/mods/TPT-Record-Mod/Older/TPT-Record-Mod 4 linux64.zip' mv "$packageName.zip" "$packageName win32.zip" "$packageName.dmg" "$packageName linux64.zip" /c/StarHTTP/TPT/"$webDirectory" + mv TPT-Record-Mod.zip 'TPT-Record-Mod win32.zip' TPT-Record-Mod.dmg 'TPT-Record-Mod linux64.zip' /c/StarHTTP/TPT/mods/TPT-Record-Mod if [[ $has_mac_arm -eq 1 ]]; then echo "Moving MacOS M1 files" #mv MACOSARM.ptu /c/StarHTTP/TPT/"$webDirectory" if [[ ! $vanillaRelease -eq 1 ]]; then cp "$packageName M1.dmg" "/c/StarHTTP/TPT/$webDirectory/Older/$packageName $buildId M1.dmg" fi mv "$packageName M1.dmg" /c/StarHTTP/TPT/"$webDirectory" fi + [[ 1 -eq 1 ]] + echo 'Moving MacOS M1 files' Moving MacOS M1 files + [[ ! 0 -eq 1 ]] + cp 'TPT-Record-Mod M1.dmg' '/c/StarHTTP/TPT/mods/TPT-Record-Mod/Older/TPT-Record-Mod 4 M1.dmg' + mv 'TPT-Record-Mod M1.dmg' /c/StarHTTP/TPT/mods/TPT-Record-Mod echo "Done moving files to web directory" >>package-output.txt + echo 'Done moving files to web directory' # Update changelogs if [[ ! $vanillaRelease -eq 1 ]]; then echo $commitSha > /c/StarHTTP/TPT/"$webDirectory"/Output/latest_commit.log cat changelog.txt | grep -ve "^#" | grep -ve "^[[:space:]]*$" | sed -e "s/^/$buildId\t/" >>/c/StarHTTP/TPT/"$webDirectory"/WIN64.info cat changelog.txt | grep -ve "^#" | grep -ve "^[[:space:]]*$" | sed -e "s/^/$buildId\t/" >>/c/StarHTTP/TPT/"$webDirectory"/WIN32.info cat changelog.txt | grep -ve "^#" | grep -ve "^[[:space:]]*$" | sed -e "s/^/$buildId\t/" >>/c/StarHTTP/TPT/"$webDirectory"/MACOS.info cat changelog.txt | grep -ve "^#" | grep -ve "^[[:space:]]*$" | sed -e "s/^/$buildId\t/" >>/c/StarHTTP/TPT/"$webDirectory"/MACOSARM.info cat changelog.txt | grep -ve "^#" | grep -ve "^[[:space:]]*$" | sed -e "s/^/$buildId\t/" >>/c/StarHTTP/TPT/"$webDirectory"/LIN64.info echo "Done updating changelogs" >>package-output.txt if [[ $releaseType == "snapshot" ]]; then rm changelog.txt fi fi + [[ ! 0 -eq 1 ]] + echo d36961609b385997faa56a60929a2d147f8b22bf + cat changelog.txt + grep -ve '^#' + grep -ve '^[[:space:]]*$' + sed -e 's/^/4\t/' + cat changelog.txt + grep -ve '^#' + grep -ve '^[[:space:]]*$' + sed -e 's/^/4\t/' + cat changelog.txt + grep -ve '^#' + grep -ve '^[[:space:]]*$' + sed -e 's/^/4\t/' + cat changelog.txt + grep -ve '^#' + grep -ve '^[[:space:]]*$' + sed -e 's/^/4\t/' + cat changelog.txt + grep -ve '^#' + grep -ve '^[[:space:]]*$' + sed -e 's/^/4\t/' + echo 'Done updating changelogs' + [[ stable == \s\n\a\p\s\h\o\t ]] echo "Archiving source code" + echo 'Archiving source code' Archiving source code curl -L https://github.com/$githubUrl/archive/refs/heads/$githubBranch.zip -o /c/StarHTTP/TPT/"$webDirectory"/"$packageName-src.zip" + curl -L https://github.com/catsoften/TPT-Record-Mod/archive/refs/heads/master.zip -o /c/StarHTTP/TPT/mods/TPT-Record-Mod/TPT-Record-Mod-src.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 718k 0 718k 0 0 991k 0 --:--:-- --:--:-- --:--:-- 991k 100 1075k 0 1075k 0 0 1462k 0 --:--:-- --:--:-- --:--:-- 34.8M if [[ ! $vanillaRelease -eq 1 ]]; then cp /c/StarHTTP/TPT/"$webDirectory"/"$packageName-src.zip" /c/StarHTTP/TPT/"$webDirectory"/Older/"$packageName $buildId-src.zip" fi + [[ ! 0 -eq 1 ]] + cp /c/StarHTTP/TPT/mods/TPT-Record-Mod/TPT-Record-Mod-src.zip '/c/StarHTTP/TPT/mods/TPT-Record-Mod/Older/TPT-Record-Mod 4-src.zip' echo "Source code archived" + echo 'Source code archived' Source code archived success=1 + success=1 echo "Release complete" + echo 'Release complete' Release complete if [[ $vanillaRelease -eq 1 ]]; then echo "msg #powder-dev $fullVersionNum finished packaging" | $packDirectory/nc.exe -w 1 localhost 9876 elif [[ $releaseType == "snapshot" ]]; then echo "msg #powder-dev $fullVersionNum released!" | $packDirectory/nc.exe -w 1 localhost 9876 else echo "msg #powder-dev $packageName $fullVersionNum released!" | $packDirectory/nc.exe -w 1 localhost 9876 fi + [[ 0 -eq 1 ]] + [[ stable == \s\n\a\p\s\h\o\t ]] + echo 'msg #powder-dev TPT-Record-Mod 3.1 (build 4) released!' + /c/Starcatcher/Github-Action-Releases/updatepackager/nc.exe -w 1 localhost 9876 exit 0 + exit 0 on_exit + on_exit + [[ 1 -eq 0 ]]