-
Notifications
You must be signed in to change notification settings - Fork 39
/
BuildLinuxPackages.sh
executable file
·70 lines (59 loc) · 1.81 KB
/
BuildLinuxPackages.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
APP_NAME="PixelViewer"
FRAMEWORK="net8.0"
RID_LIST=("linux-x64" "linux-arm64")
CONFIG="Release"
TRIM_ASSEMBLIES="true"
READY_TO_RUN="false"
echo "********** Start building $APP_NAME **********"
# Get application version
VERSION=$(dotnet run --project PackagingTool get-current-version $APP_NAME/$APP_NAME.csproj)
if [ "$?" != "0" ]; then
echo "Unable to get version of $APP_NAME"
exit
fi
echo "Version: $VERSION"
PREV_VERSION=$(dotnet run --project PackagingTool get-previous-version $APP_NAME/$APP_NAME.csproj $VERSION)
if [ ! -z "$PREV_VERSION" ]; then
echo "Previous version: $PREV_VERSION"
fi
# Create output directory
if [[ ! -d "./Packages/$VERSION" ]]; then
echo "Create directory 'Packages/$VERSION'"
mkdir ./Packages/$VERSION
if [ "$?" != "0" ]; then
exit
fi
fi
# Build packages
for i in "${!RID_LIST[@]}"; do
RID=${RID_LIST[$i]}
echo " "
echo "[$RID]"
echo " "
# clean
rm -r ./$APP_NAME/bin/$CONFIG/$FRAMEWORK/$RID
dotnet restore $APP_NAME -r $RID
if [ "$?" != "0" ]; then
exit
fi
dotnet clean $APP_NAME -c $CONFIG -r $RID
if [ "$?" != "0" ]; then
exit
fi
# build
dotnet publish $APP_NAME -c $CONFIG -r $RID --self-contained true -p:PublishTrimmed=$TRIM_ASSEMBLIES -p:PublishReadyToRun=$READY_TO_RUN
if [ "$?" != "0" ]; then
exit
fi
# zip package
ditto -c -k --sequesterRsrc "./$APP_NAME/bin/$CONFIG/$FRAMEWORK/$RID/publish/" "./Packages/$VERSION/$APP_NAME-$VERSION-$RID.zip"
if [ "$?" != "0" ]; then
exit
fi
done
# Generate diff packages
if [ ! -z "$PREV_VERSION" ]; then
dotnet run --project PackagingTool create-diff-packages linux $PREV_VERSION $VERSION
fi
# Generate package manifest
# dotnet run --project PackagingTool create-package-manifest linux $APP_NAME $VERSION