-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from WolfwithSword/versioning-impl
Built-in Versioning & Updater scripts
- Loading branch information
Showing
7 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__='dev' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
@echo off | ||
SET latest= | ||
echo Getting Latest | ||
set latest_cmd="curl -s https://api.github.com/repos/WolfwithSword/TwitchCollabNetwork/releases/latest | FINDSTR \"tag_name\"" | ||
FOR /F "delims=" %%a IN ('%latest_cmd%') DO SET raw_latest=%%a | ||
FOR /F "tokens=2" %%a IN ('echo %raw_latest%') DO SET latest=%%a | ||
set latest=%latest:"=% | ||
|
||
set current= | ||
cd ../ | ||
FOR /F "tokens=3" %%a IN ('"twitchcollabnetwork.exe -v"') DO SET current=%%a | ||
cd ./updater | ||
|
||
|
||
echo Latest Version: %latest% | ||
IF "%current%"=="" ( | ||
echo Current Version: Unknown. May be old, dev, or nightly build | ||
echo Please update manually to an officially released build at https://github.com/WolfwithSword/TwitchCollabNetwork/releases/latest | ||
timeout 6 > NUL | ||
exit | ||
) ELSE ( | ||
echo Current Version: %current% | ||
) | ||
|
||
IF "%current%"=="%latest%" ( | ||
echo "Already up to date..." | ||
timeout 2 > NUL | ||
exit | ||
) | ||
|
||
if exist ".\tmp\" rd /s /q ".\tmp\" | ||
|
||
echo Downloading... | ||
timeout 1 > NUL | ||
SET url="https://github.com/WolfwithSword/TwitchCollabNetwork/releases/download/%latest%/twitchcollabnetwork-windows-%latest%.zip" | ||
SET output="%~dp0tmp\twitchcollabnetwork-%latest%.zip" | ||
echo %output% | ||
mkdir "%~dp0tmp" | ||
bitsadmin /transfer "download-tcn-latest" /download /priority FOREGROUND %url% "%output%" | ||
powershell -command "Expand-Archive -Force '%output%' '%~dp0tmp\'" | ||
del %~dp0tmp\twitchcollabnetwork-%latest%\config.ini | ||
del %~dp0tmp\*.zip | ||
echo: | ||
echo Updating... | ||
echo D|xcopy /s /e /y %~dp0tmp\twitchcollabnetwork-%latest%\ ../ | ||
echo: | ||
|
||
echo Done updating TwitchCollabNetwork to %latest% | ||
echo: | ||
echo Warning: config.ini was not copied over. Please verify at https://github.com/WolfwithSword/TwitchCollabNetwork/ if any new config items are missing from your existing config. | ||
echo: | ||
timeout 4 > NUL | ||
echo Cleaning up... | ||
|
||
if exist ".\tmp\" rd /s /q ".\tmp\" | ||
timeout 2 > NUL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/sh | ||
|
||
latest=$(curl -s https://api.github.com/repos/WolfwithSword/TwitchCollabNetwork/releases/latest | grep -i "tag_name" | awk -F '"' '{print $4}') | ||
current=$("../twitchcollabnetwork" -v | awk '{print $3}') | ||
|
||
echo "Latest Version: $latest" | ||
if [[ -z "$current" ]]; then | ||
echo "Current Version: Unknown (May be old, dev, or nightly build)" | ||
echo "Please update manually to an officially released build at https://github.com/WolfwithSword/TwitchCollabNetwork/releases/latest" | ||
sleep 6 | ||
exit | ||
else | ||
echo "Current Version: $current" | ||
fi | ||
|
||
sleep 2 | ||
|
||
if [[ "$current" == "$latest" ]]; then | ||
echo "Already up to date..." | ||
sleep 2 | ||
exit | ||
fi | ||
|
||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | ||
platform="ubuntu" | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
platform="macos" | ||
elif [[ "$OSTYPE" == 'cygwin' || "$OSTYPE" == 'win32' || "$OSTYPE" == 'msys' ]]; then | ||
platform="windows" | ||
else | ||
platform="unknown" | ||
fi | ||
|
||
if [[ "$platform" == "unknown" ]]; then | ||
echo "Unknown platform" | ||
echo "Please update manually to an officially released build at https://github.com/WolfwithSword/TwitchCollabNetwork/releases/latest" | ||
sleep 6 | ||
exit | ||
fi | ||
|
||
sleep 2 | ||
|
||
if [ -d "./tmp" ]; then | ||
printf '%s\n' "Removing Lock (./tmp)" | ||
rm -rf "./tmp" | ||
fi | ||
|
||
dl_url="https://github.com/WolfwithSword/TwitchCollabNetwork/releases/download/$latest/twitchcollabnetwork-$platform-$latest.zip" | ||
output="./tmp/twitchcollabnetwork-$platform-$latest.zip" | ||
|
||
echo | ||
echo "Downloading..." | ||
|
||
mkdir -p ./tmp | ||
curl -L $dl_url > $output | ||
|
||
echo | ||
echo "Download complete" | ||
|
||
unzip -q $output -d ./tmp -x "twitchcollabnetwork-$latest/config.ini" | ||
echo $pwd | ||
|
||
output="./tmp/$(ls ./tmp | grep ".zip")" | ||
if [ -e "$output" ]; then | ||
rm -rf "$output" | ||
fi | ||
#rm "./tmp/$(ls ./tmp | grep ".zip")" | ||
|
||
outfolder="./tmp/$(ls ./tmp | awk '{print $1}')/*" | ||
|
||
cp -r $outfolder "../" | ||
sleep 1 | ||
echo "Done updating TwitchCollabNetwork to $latest" | ||
echo | ||
echo "Warning: config.ini was not copied over. Please verify at https://github.com/WolfwithSword/TwitchCollabNetwork/ if any new config items are missing from your existing config." | ||
echo | ||
sleep 5 | ||
echo "Cleaning up..." | ||
rm -rf ./tmp | ||
sleep 1 |