-
Notifications
You must be signed in to change notification settings - Fork 88
/
nightly.sh
executable file
·110 lines (90 loc) · 4.18 KB
/
nightly.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
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST \
-d "{\"body\": \"A build has started for this pull request! \"}" \
"https://api.github.com/repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments"
yarn run build:electron:prod
# Linux
if [[ $TRUE_COMMIT_MESSAGES != *"-linux"* ]]
then
echo 'Linux build' && echo -en 'travis_fold:start:script.linux\\r'
DEBUG=electron-builder yarn run travis:linux
cd packages
mv `ls | grep "particl-desktop.*linux-x64.zip"` particl-desktop-linux-x64-PR$TRAVIS_PULL_REQUEST-$TRUE_COMMIT.zip
mv `ls | grep "particl-desktop.*linux-amd64.deb"` particl-desktop-linux-amd64-PR$TRAVIS_PULL_REQUEST-$TRUE_COMMIT.deb
cd ..
echo -en 'travis_fold:end:script.linux\\r'
fi
# OSX
if [[ $TRUE_COMMIT_MESSAGES != *"-mac"* ]]
then
echo 'Mac build' && echo -en 'travis_fold:start:script.mac\\r'
DEBUG=electron-builder yarn run travis:mac
cd packages
mv `ls | grep "particl-desktop.*mac.zip"` particl-desktop-mac-PR$TRAVIS_PULL_REQUEST-$TRUE_COMMIT.zip
cd ..
echo -en 'travis_fold:end:script.mac\\r'
fi
# Winblows
if [[ $TRUE_COMMIT_MESSAGES != *"-win"* ]]
then
echo 'Win build' && echo -en 'travis_fold:start:script.win\\r'
# sudo dpkg --add-architecture i386
# wget -nc https://dl.winehq.org/wine-builds/Release.key
# sudo apt-key add Release.key
# sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
# sudo apt-get update -y
# sudo apt-get install -y --force-yes wine-stable winehq-stable
# WINEARCH=win32 winecfg
# wine regedit /d 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\Windows\CurrentVersion\Explorer\Desktop\Namespace\{9D20AAE8-0625-44B0-9CA7-71889C2254D9}'
# echo disable > "${WINEPREFIX:-${HOME}/.wine}/.update-timestamp"
DEBUG=electron-builder yarn run travis:win64
cd packages
zip -r particl-desktop-win-x64-PR$TRAVIS_PULL_REQUEST-$TRUE_COMMIT.zip win-unpacked
cd ..
DEBUG=electron-builder yarn run travis:win32
cd packages
zip -r particl-desktop-win-ia32-PR$TRAVIS_PULL_REQUEST-$TRUE_COMMIT.zip win-ia32-unpacked
cd ..
ls -l ./packages
echo -en 'travis_fold:end:script.win\\r'
fi
# Upload
if [[ $TRUE_COMMIT_MESSAGES != *"-upload"* ]]
then
cd packages
declare -a Uploads
Uploads=("${TRUE_COMMIT_MESSAGES}\nNote: the download links expire after 10 days.\n")
export AUTHOR=$(git --no-pager show -s --format='%an %ae' $TRUE_COMMIT)
Matrix=("<p><strong>Help developer ${AUTHOR} by testing these builds and reporting any issues!</strong><br />${TRUE_COMMIT_MESSAGES}</p>\n<p>Note: the download links expire after 10 days.</p>\n")
for fn in `ls | grep "particl-desktop"`; do
echo "Uploading $fn"
url="$(curl -H "Max-Days: 10" -s --upload-file $fn https://transfer.sh/$fn)\n"
onion="$(echo $url | sed 's,https://transfer.sh,http://jxm5d6emw5rknovg.onion,g')"
checksum="$(sha256sum $fn)\n"
Uploads=(${Uploads[@]} "\`\`\`\n")
Uploads=(${Uploads[@]} $checksum)
Uploads=(${Uploads[@]} $url)
Uploads=(${Uploads[@]} $onion)
Uploads=(${Uploads[@]} "\`\`\`\n\n")
# Build message for Matrix
Matrix=(${Matrix[@]} "<pre><code>")
Matrix=(${Matrix[@]} $checksum)
Matrix=(${Matrix[@]} $url)
Matrix=(${Matrix[@]} $onion)
Matrix=(${Matrix[@]} "</code></pre>\n\n")
done
echo -e ${Uploads[@]}
export MSG=$(echo ${Uploads[@]})
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST \
-d "{\"body\": \"${MSG}\"}" \
"https://api.github.com/repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments"
# Request testing from the test channel.
if [[ $TRUE_COMMIT_MESSAGES == *"+request"* ]]
then
export MATRIX_MSG=$(echo ${Matrix[@]})
export TIMESTAMP=$(date +%s)
export TEST_ROOM="wvPJvGRnvoVersNXPK"
export DEV_ROOM="QHzKmRcPojxJmQRhMD"
curl 'https://matrix.org/_matrix/client/r0/rooms/!'"${TEST_ROOM}"'%3Amatrix.org/send/m.room.message/m'"${TIMESTAMP}"'?access_token='"${MATRIX_TOKEN}" \
-X PUT --data '{"msgtype":"m.text", "format": "org.matrix.custom.html", "body": "'"${MSG}"'" ,"formatted_body":"'"${MATRIX_MSG}"'Married to Rutherford, hubby for life <3"}'
fi
fi