-
Notifications
You must be signed in to change notification settings - Fork 12
/
release-desktop.sh
executable file
·123 lines (98 loc) · 4.08 KB
/
release-desktop.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
echo "Remember: This requires node.js >= 7..."
if [[ -z "$1" ]]; then
echo "Error: Missing argument 'GitHub token'!";
exit;
fi;
GITHUB_TOKEN="$1"
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')
function commertialName() {
if [ "$1" == "blocks" ] ; then
echo "jr"
fi
if [ "$1" == "code" ] ; then
echo "sr"
fi
if [ "$1" == "teacher" ] ; then
echo "teacher"
fi
}
function try {
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "!!!Error!!! with $1" >&2
exit $status
fi
return $status
}
function build() {
unset GH_TOKEN
sudo rm -rf ./dist/
try yarn dist:docker "yarn dist --mode $TYPE --platform linux --arch x64 --target AppImage"
try yarn dist:docker "yarn dist --mode $TYPE --platform win --arch ia32 --target nsis"
try yarn dist:docker "yarn dist --mode $TYPE --platform win --arch x64 --target nsis"
}
rm -rf app/guides.zip app/guides app/cache_config.json
# ---
TYPE="blocks"
echo "BUILDING '$TYPE' WITH ELECTRON..."
build
echo "CREATING '$TYPE' ONE-FILE PACKAGES..."
LINUX_NAME_1=gobstones-$(commertialName $TYPE)-linux-$PACKAGE_VERSION.AppImage
WINDOWS_NAME_1=gobstones-$(commertialName $TYPE)-windows-$PACKAGE_VERSION.exe
WINDOWS32_NAME_1=gobstones-$(commertialName $TYPE)-windows-ia32-$PACKAGE_VERSION.zip
cp "./dist/gobstones-$(commertialName $TYPE)_$(echo $PACKAGE_VERSION)_linux_x86_64.AppImage" $LINUX_NAME_1
cd ./dist/win-ia32-unpacked ; zip -rq ../../$WINDOWS32_NAME_1 . ; cd ../..
cp "./dist/gobstones-$(commertialName $TYPE)_$(echo $PACKAGE_VERSION)_win.exe" $WINDOWS_NAME_1
mv "$LINUX_NAME_1" node_modules/
mv "$WINDOWS_NAME_1" node_modules/
mv "$WINDOWS32_NAME_1" node_modules/
# ---
TYPE="code"
echo "BUILDING '$TYPE' WITH ELECTRON..."
build
echo "CREATING '$TYPE' ONE-FILE PACKAGES..."
LINUX_NAME_2=gobstones-$(commertialName $TYPE)-linux-$PACKAGE_VERSION.AppImage
WINDOWS_NAME_2=gobstones-$(commertialName $TYPE)-windows-$PACKAGE_VERSION.exe
WINDOWS32_NAME_2=gobstones-$(commertialName $TYPE)-windows-ia32-$PACKAGE_VERSION.zip
cp "./dist/gobstones-$(commertialName $TYPE)_$(echo $PACKAGE_VERSION)_linux_x86_64.AppImage" $LINUX_NAME_2
cd ./dist/win-ia32-unpacked ; zip -rq ../../$WINDOWS32_NAME_2 . ; cd ../..
cp "./dist/gobstones-$(commertialName $TYPE)_$(echo $PACKAGE_VERSION)_win.exe" $WINDOWS_NAME_2
mv "$LINUX_NAME_2" node_modules/
mv "$WINDOWS_NAME_2" node_modules/
mv "$WINDOWS32_NAME_2" node_modules/
# ---
TYPE="teacher"
echo "BUILDING '$TYPE' WITH ELECTRON..."
build
echo "CREATING '$TYPE' ONE-FILE PACKAGES..."
LINUX_NAME_3=gobstones-$(commertialName $TYPE)-linux-$PACKAGE_VERSION.AppImage
WINDOWS_NAME_3=gobstones-$(commertialName $TYPE)-windows-$PACKAGE_VERSION.exe
WINDOWS32_NAME_3=gobstones-$(commertialName $TYPE)-windows-ia32-$PACKAGE_VERSION.zip
cp "./dist/gobstones-$(commertialName $TYPE)_$(echo $PACKAGE_VERSION)_linux_x86_64.AppImage" $LINUX_NAME_3
cd ./dist/win-ia32-unpacked ; zip -rq ../../$WINDOWS32_NAME_3 . ; cd ../..
cp "./dist/gobstones-$(commertialName $TYPE)_$(echo $PACKAGE_VERSION)_win.exe" $WINDOWS_NAME_3
mv "$LINUX_NAME_3" node_modules/
mv "$WINDOWS_NAME_3" node_modules/
mv "$WINDOWS32_NAME_3" node_modules/
# ---
mv "node_modules/$LINUX_NAME_1" "$LINUX_NAME_1"
mv "node_modules/$WINDOWS_NAME_1" "$WINDOWS_NAME_1"
mv "node_modules/$WINDOWS32_NAME_1" "$WINDOWS32_NAME_1"
mv "node_modules/$LINUX_NAME_2" "$LINUX_NAME_2"
mv "node_modules/$WINDOWS_NAME_2" "$WINDOWS_NAME_2"
mv "node_modules/$WINDOWS32_NAME_2" "$WINDOWS32_NAME_2"
mv "node_modules/$LINUX_NAME_3" "$LINUX_NAME_3"
mv "node_modules/$WINDOWS_NAME_3" "$WINDOWS_NAME_3"
mv "node_modules/$WINDOWS32_NAME_3" "$WINDOWS32_NAME_3"
# ---
echo "DEPLOYING DESKTOP VERSION $PACKAGE_VERSION..."
echo "PUBLISHING..."
./node_modules/.bin/publish-release --token $GITHUB_TOKEN --owner gobstones --repo gobstones-web-desktop --tag "$PACKAGE_VERSION" --name "$PACKAGE_VERSION" --assets $LINUX_NAME_1,$WINDOWS_NAME_1,$LINUX_NAME_2,$WINDOWS_NAME_2,$LINUX_NAME_3,$WINDOWS_NAME_3,$WINDOWS32_NAME_1,$WINDOWS32_NAME_2,$WINDOWS32_NAME_3 --notes "Gobstones Web - Desktop"
echo "DONE."