-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-release.sh
executable file
·47 lines (41 loc) · 1008 Bytes
/
make-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
#!/bin/sh
set -e
# set -x
# helpers
beginswith() { case $2 in "$1"*) true;; *) false;; esac; }
# parameterize
if [ -z "$1" ]; then
echo "Must specify a release version!"
exit 1
else
VERSION="$1"
fi
if [ -z "$2" ]; then
TARGET='linux-x64'
else
TARGET="$2"
fi
# derive
if [ "$TARGET" = 'linux-x64' ]; then
FRAMEWORK='net7.0'
else
FRAMEWORK='net6.0'
fi
# prepare
docker build -t dotnet:7.0-bionic .
# compile
docker run -it --rm \
-v "$(pwd)":/source -w /source \
dotnet:7.0-bionic \
/bin/bash -c "/opt/dotnet publish -o build/ -c Release -r $TARGET -f $FRAMEWORK && chown -R $(id -u):$(id -g) ."
# package
cd build
if [ "$TARGET" = 'linux-x64' ]; then
tar -czf graf-$VERSION-$TARGET.tar.gz graf
sha256sum graf-$VERSION-$TARGET.tar.gz | tee graf-$VERSION-$TARGET.tar.gz.sha256
elif beginswith win $TARGET; then
VERSION=$(echo "$VERSION" | sed 's/\./_/g')
zip -9 -k graf-$VERSION-$TARGET.zip graf.exe
sha256sum graf-$VERSION-$TARGET.zip | tee graf-$VERSION-"$TARGET"_zip_sha256.txt
fi
cd ..