-
Notifications
You must be signed in to change notification settings - Fork 6
/
release.sh
executable file
·184 lines (147 loc) · 4.79 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/bash
#environment variables
: ${OSXUSER:=}
: ${COWBUILDER:=cowbuilder.local} # linux/windows (mingw)
: ${OSXMACHINE:=oscbuilder.local} # 10.6 (i386/x86)
: ${MACMACHINE:=macbuilder.local} # 11.0 (arm)
test -f "$HOME/.buildcfg.sh" && . "$HOME/.buildcfg.sh"
NEWVERSION=$1
if test -n "$(echo "$NEWVERSION" | sed 's/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$//')"; then
NEWVERSION=""
fi
if test -z "$NEWVERSION"; then
echo -n "No X.X.X version given as argument. Do a binary build only? [y/N] "
read -n1 a
echo
if test "$a" != "y" -a "$a" != "Y"; then
exit 1
fi
fi
if test -n "$NEWVERSION"; then
echo "commit pending changes.."
git commit -a
vi ChangeLog
make VERSION="v${NEWVERSION}" clean man || exit
git status -s
echo " - Version v${NEWVERSION}"
echo -n "git commit and tag? [Y/n]"
read -n1 a
echo
if test "$a" == "n" -o "$a" == "N"; then
exit 1
fi
git commit -m "finalize changelog" ChangeLog doc/harvid.1
git tag "v${NEWVERSION}"
echo -n "git push and build? [Y/n] "
read -n1 a
echo
if test "$a" == "n" -o "$a" == "N"; then
exit 1
fi
git push origin && git push origin --tags
git push rg42 && git push rg42 --tags
fi
VERSION=$(git describe --tags HEAD)
test -n "$VERSION" || exit
/bin/ping -q -c1 ${OSXMACHINE} &>/dev/null \
&& /usr/sbin/arp -n ${OSXMACHINE} &>/dev/null
ok=$?
if test "$ok" != 0; then
echo "OSX build host can not be reached."
exit
fi
/bin/ping -q -c1 ${COWBUILDER} &>/dev/null \
&& /usr/sbin/arp -n ${COWBUILDER} &>/dev/null
ok=$?
if test "$ok" != 0; then
echo "Linux cowbuild host can not be reached."
exit
fi
echo "building linux static and windows versions"
ssh $COWBUILDER ~/bin/build-harvid.sh
ok=$?
if test "$ok" != 0; then
echo "remote build failed"
exit
fi
echo "building OSX/Intel versions"
if test -n "$OSXFROMSCRATCH"; then
echo "building osx package from scratch"
ssh ${OSXUSER}${OSXMACHINE} << EOF
exec /bin/bash -l
curl -kL -o /tmp/harvid-x-pbuildstatic.sh https://raw.github.com/x42/harvid/master/x-osx-buildstack.sh
chmod +x /tmp/harvid-x-pbuildstatic.sh
/tmp/harvid-x-pbuildstatic.sh
EOF
else
echo "building osx package with existing stack"
ssh ${OSXUSER}${OSXMACHINE} << EOF
exec /bin/bash -l
rm -rf harvid
git clone -b master --single-branch https://github.com/x42/harvid.git
cd harvid
./x-osx-bundle.sh
cd ..
rm -rf harvid
EOF
fi
ok=$?
if test "$ok" != 0; then
echo "remote build failed"
exit
fi
echo "building macOS/ARM versions"
ssh $MACMACHINE ./bin/build-harvid.sh
ok=$?
if test "$ok" != 0; then
echo "remote build failed"
exit
fi
# collect binaries from build-hosts
rsync -Pa $COWBUILDER:/tmp/harvid-i386-linux-gnu-${VERSION}.tgz site/releases/ || exit
rsync -Pa $COWBUILDER:/tmp/harvid-x86_64-linux-gnu-${VERSION}.tgz site/releases/ || exit
rsync -Pa $COWBUILDER:/tmp/harvid_installer-w32-${VERSION}.exe site/releases/ || exit
rsync -Pa $COWBUILDER:/tmp/harvid_installer-w64-${VERSION}.exe site/releases/ || exit
rsync -Pa $COWBUILDER:/tmp/harvid_w32-${VERSION}.tar.xz tmp/ || exit
rsync -Pa $COWBUILDER:/tmp/harvid_w64-${VERSION}.tar.xz tmp/ || exit
rsync -Pa ${OSXUSER}$OSXMACHINE:/tmp/harvid-${VERSION}.pkg site/releases/ || exit
rsync -Pa ${OSXUSER}$OSXMACHINE:/tmp/Harvid-${VERSION}.dmg site/releases/ || exit
rsync -Pa ${OSXUSER}$OSXMACHINE:/tmp/harvid-osx-${VERSION}.tgz tmp/ || exit
rsync -Pa $MACMACHINE:/tmp/Harvid-arm64-${VERSION}.dmg site/releases/ || exit
rsync -Pa $MACMACHINE:/tmp/harvid-macOS-arm64-${VERSION}.tgz site/releases/ || exit
echo -n "${VERSION}" > site/releases/harvid_version.txt
echo "preparing website"
# git clone --single-branch -b gh-pages site
sed 's/@VERSION@/'$VERSION'/g;s/@DATE@/'"`date -R`"'/g;' site/index.tpl.html > site/index.html || exit
groff -m mandoc -Thtml doc/harvid.1 > site/harvid.1.html
cd site || exit
git add harvid.1.html releases/harvid_version.txt
git add releases/*-${VERSION}.* || exit
rm -f $(ls releases/* | grep -v "${VERSION}\." | grep -v harvid_version.txt | grep -v harvid-v0.8.2.dmg | grep -v harvid-v0.8.2.pkg | tr '\n' ' ')
git commit -a --amend -m "website $VERSION" || exit
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
echo -n "git upload site and binaries? [Y/n] "
read -n1 a
echo
if test "$a" == "n" -o "$a" == "N"; then
exit 1
fi
echo "uploading to github.."
git push --force
echo "uploading to ardour.org"
rsync -Pa \
../tmp/harvid-osx-${VERSION}.tgz \
../tmp/harvid_w32-${VERSION}.tar.xz \
../tmp/harvid_w64-${VERSION}.tar.xz \
releases/harvid-${VERSION}.dmg \
releases/harvid-${VERSION}.pkg \
releases/harvid-arm64-${VERSION}.dmg \
releases/harvid-arm64-${VERSION}.pkg \
releases/harvid-i386-linux-gnu-${VERSION}.tgz \
releases/harvid-x86_64-linux-gnu-${VERSION}.tgz \
releases/harvid_installer-w32-${VERSION}.exe \
releases/harvid_installer-w64-${VERSION}.exe \
releases/harvid_version.txt \
ardour.org:/persist/files/video-tools/