-
Notifications
You must be signed in to change notification settings - Fork 2
/
release.sh
executable file
·78 lines (62 loc) · 1.71 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
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
NET_FOLDER="net8.0"
platforms=("linux-x64" "win-x64" "osx-x64" "osx-arm64")
publish() {
for platform in "${platforms[@]}"; do
dotnet publish -c Release -r "$platform" --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
done;
cd ./bin/Release/$NET_FOLDER/ || exit
rm ./*/publish/*.pdb
}
create_release_dirs() {
for platform in "${platforms[@]}"; do
mkdir "$SCRIPT_DIR/bin/$platform";
done;
}
copy_releases() {
for platform in "${platforms[@]}"; do
cp -r "$SCRIPT_DIR/ThirtyDollarVisualizer/bin/Release/$NET_FOLDER/$platform/publish/" "$SCRIPT_DIR/bin/$platform" || exit
cp -r "$SCRIPT_DIR/ThirtyDollarConverter.GUI/bin/Release/$NET_FOLDER/$platform/publish/" "$SCRIPT_DIR/bin/$platform" || exit
done;
}
zip_releases() {
for platform in "${platforms[@]}"; do
cd "$SCRIPT_DIR/bin/$platform/publish" || exit
rm -rf "./runtimes" || exit
zip -r9 "$SCRIPT_DIR/bin/$platform.zip" "."
cd - || exit
done;
}
clean_releases() {
for platform in "${platforms[@]}"; do
cd "$SCRIPT_DIR/bin/$platform/publish" || exit
rm -rf ./*.dll ./*.so ./*.dylib
cd - || exit
done;
}
if [ "$#" -gt 0 ]; then
for arg in "$@"; do
if [ "$arg" == "--zip-only" ]; then
zip_releases
exit
fi
done;
fi
rm -rf "${SCRIPT_DIR:?}/bin"
mkdir "$SCRIPT_DIR/bin"
cd ./ThirtyDollarConverter.GUI || exit
publish
cd "$SCRIPT_DIR" || exit
cd ./ThirtyDollarVisualizer || exit
publish
create_release_dirs
copy_releases
clean_releases
if [ "$#" -gt 0 ]; then
for arg in "$@"; do
if [ "$arg" == "-z" ]; then
zip_releases
fi
done;
fi