This repository has been archived by the owner on Nov 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
/
release.sh
executable file
·141 lines (121 loc) · 4.02 KB
/
release.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
# error output terminates this script
set -e
# This script creates a Sia-UI release for all 3 platforms: osx (darwin),
# linux, and windows. It takes 5 arguments, the first two arguments are the
# private and public key used to sign the release archives. The last three
# arguments are semver strings, the first of which being the ui version, second
# being the Sia version, and third being the electron version.
if [[ -z $1 || -z $2 ]]; then
echo "Usage: $0 privatekey publickey uiversion siaversion electronversion"
exit 1
fi
# ensure we have a clean node_modules
rm -rf ./node_modules
npm install
# build the UI's js
rm -rf ./dist
npm run build-production
uiVersion=${3:-v1.3.3}
siaVersion=${4:-v1.3.3}
electronVersion=${5:-v1.6.4}
# fourth argument is the public key file path.
keyFile=`readlink -f $1`
pubkeyFile=`readlink -f $2`
electronOSX="https://github.com/electron/electron/releases/download/${electronVersion}/electron-${electronVersion}-darwin-x64.zip"
electronLinux="https://github.com/electron/electron/releases/download/${electronVersion}/electron-${electronVersion}-linux-x64.zip"
electronWindows="https://github.com/electron/electron/releases/download/${electronVersion}/electron-${electronVersion}-win32-x64.zip"
siaOSX="/home/luke/go/src/github.com/NebulousLabs/Sia/release/Sia-${siaVersion}-darwin-amd64.zip"
siaLinux="/home/luke/go/src/github.com/NebulousLabs/Sia/release/Sia-${siaVersion}-linux-amd64.zip"
siaWindows="/home/luke/go/src/github.com/NebulousLabs/Sia/release/Sia-${siaVersion}-windows-amd64.zip"
rm -rf release/
mkdir -p release/{osx,linux,win32}
# package copies all the required javascript, html, and assets into an electron package.
package() {
src=$1
dest=$2
cp -r ${src}/{plugins,assets,css,dist,index.html,package.json,js} $dest
}
buildOSX() {
cd release/osx
wget $electronOSX
unzip ./electron*
mv Electron.app Sia-UI.app
mv Sia-UI.app/Contents/MacOS/Electron Sia-UI.app/Contents/MacOS/Sia-UI
# NOTE: this only works with GNU sed, other platforms (like OSX) may fail here
sed -i 's/>Electron</>Sia-UI</' Sia-UI.app/Contents/Info.plist
sed -i 's/>'"${electronVersion:1}"'</>'"${siaVersion:1}"'</' Sia-UI.app/Contents/Info.plist
sed -i 's/>com.github.electron\</>com.nebulouslabs.siaui</' Sia-UI.app/Contents/Info.plist
sed -i 's/>electron.icns</>icon.icns</' Sia-UI.app/Contents/Info.plist
cp ../../assets/icon.icns Sia-UI.app/Contents/Resources/
rm -r Sia-UI.app/Contents/Resources/default_app.asar
mkdir Sia-UI.app/Contents/Resources/app
(
cd Sia-UI.app/Contents/Resources/app
cp $siaOSX .
unzip ./Sia-*
rm ./Sia*.zip
mv ./Sia-* ./Sia
)
package "../../" "Sia-UI.app/Contents/Resources/app"
rm -r electron*.zip
cp ../../LICENSE .
}
buildLinux() {
cd release/linux
wget $electronLinux
unzip ./electron*
mv electron Sia-UI
rm -r resources/default_app.asar
mkdir resources/app
(
cd resources/app
cp $siaLinux .
unzip ./Sia-*
rm ./Sia*.zip
mv ./Sia-* ./Sia
)
package "../../" "resources/app"
rm -r electron*.zip
cp ../../LICENSE .
}
buildWindows() {
cd release/win32
wget $electronWindows
unzip ./electron*
mv electron.exe Sia-UI.exe
wget https://github.com/electron/rcedit/releases/download/v0.1.0/rcedit.exe
wine rcedit.exe Sia-UI.exe --set-icon '../../assets/icon.ico'
rm -f rcedit.exe
rm resources/default_app.asar
mkdir resources/app
(
cd resources/app
cp $siaWindows .
unzip ./Sia-*
rm ./Sia*.zip
mv ./Sia-* ./Sia
)
package "../../" "resources/app"
rm -r electron*.zip
cp ../../LICENSE .
}
# make osx release
( buildOSX )
# make linux release
( buildLinux )
# make windows release
( buildWindows )
# make signed zip archives for each release
for os in win32 linux osx; do
(
cd release/${os}
zip -r ../Sia-UI-${uiVersion}-${os}-x64.zip .
cd ..
openssl dgst -sha256 -sign $keyFile -out Sia-UI-${uiVersion}-${os}-x64.zip.sig Sia-UI-${uiVersion}-${os}-x64.zip
if [[ -n $pubkeyFile ]]; then
openssl dgst -sha256 -verify $pubkeyFile -signature Sia-UI-${uiVersion}-${os}-x64.zip.sig Sia-UI-${uiVersion}-${os}-x64.zip
fi
rm -rf release/${os}
)
done