-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun.sh
executable file
·68 lines (47 loc) · 1.78 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#/bin/sh
download_and_run(){
GIT_USERNAME="$1"
GIT_REPOSITORY="$2"
TAG="$3"
echo "Downloading $GIT_USERNAME/$GIT_REPOSITORY with tag $TAG"
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
cd $tmp_dir
case "$(uname -s)" in
Darwin)
echo 'Mac OS X'
curl -s -L --output - "https://github.com/$GIT_USERNAME/$GIT_REPOSITORY/releases/download/$TAG/StandaloneOSX.zip" | bsdtar -xf-
xattr -d com.apple.quarantine StandaloneOSX.app
cd StandaloneOSX.app/Contents/MacOS
chmod +x *
find . -type f -exec "{}" +;
;;
Linux)
echo 'Linux'
curl -s -L "https://github.com/$GIT_USERNAME/$GIT_REPOSITORY/releases/download/$TAG/StandaloneLinux64.zip" --output StandaloneLinux64.zip
unzip StandaloneLinux64.zip
rm StandaloneLinux64.zip
chmod +x StandaloneLinux64
./StandaloneLinux64
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
echo 'MS Windows'
curl -s -L -k "https://github.com/$GIT_USERNAME/$GIT_REPOSITORY/releases/download/$TAG/StandaloneWindows.zip" --output StandaloneWindows.zip
unzip StandaloneWindows.zip
rm StandaloneWindows.zip
./StandaloneWindows.exe
;;
*)
echo 'Unsupported OS'
;;
esac
rm -rf $tmp_dir
}
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
GIT_USERNAME=humbertodias
GIT_REPOSITORY=unity-real-time-strategy-game
LATEST_TAG=$(get_latest_release $GIT_USERNAME/$GIT_REPOSITORY)
download_and_run $GIT_USERNAME $GIT_REPOSITORY $LATEST_TAG