-
Notifications
You must be signed in to change notification settings - Fork 6
/
release.sh
64 lines (56 loc) · 1.84 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
#!bin/sh
numberOfFeatures=3
featuresToBuild=('--no-default-features' '--features mysql_addons' '--features sqlite_addons' '--all-features')
packagesNames=('doteur_light' 'doteur_mysql' 'doteur_sqlite' 'doteur')
target_names=('x86_64-unknown-linux-gnu' 'x86_64-pc-windows-gnu')
if ! command -v rustup &> /dev/null
then
echo "rustup could not be found, please ensure it is installed"
echo "Exiting..."
exit
fi
target_args=""
for target in "${target_names[@]}"; do
target_args+="--target ${target} "
done
rm -rf release
mkdir release
rm -rf target
echo ""
echo "Target args ${target_args}"
echo "-----------------------"
for ((j=0;j<=numberOfFeatures;j++)); do
echo "";
echo "** Time for $i with ${featuresToBuild[j]} **"
echo "Running cargo build --bin doteur --release ${featuresToBuild[j]} ${target_args} -q ";
cargo build --release ${featuresToBuild[j]} ${target_args} -q ;
echo 'Cargo build done';
for target in "${target_names[@]}"; do
echo 'Using upx';
if [ $target = "x86_64-pc-windows-gnu" ]; then
upx target/$target/release/doteur.exe;
else
upx target/$target/release/doteur;
fi
echo "Moving to release dir"
cd target/$target/
echo "Updating dir name"
mv release doteur
echo "Include copy of licenese and README"
cp ../../LICENCE.MD doteur
cp ../../README.md doteur
echo "Zipping in";
zip ../../release/${packagesNames[j]}_$target doteur/doteur* doteur/LICENCE.md doteur/README.md -qq -r;
echo "Back to former dir"
cd ../..
echo "Adding sum";
md5sum ./release/${packagesNames[j]}_$target.zip > ./release/${packagesNames[j]}_$target.zip.md5
done
echo "Cleaning release dir";
rm -r target/$target;
echo "Done with ${featuresToBuild[j]}";
done
cargo doc -q --all-features;
zip ./release/doteur_doc ./target/doc -r --q;
md5sum release/doteur_doc.zip > release/doteur_doc.zip.md5 ;
echo "Done with success"