forked from CmlLib/CmlLib.Core
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·49 lines (39 loc) · 1.67 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
#!/bin/sh
export CMLLIB_RELEASE_VERSION_NAME
if [ "$1" != "" ]; then
versionName=$1
elif [ "$CMLLIB_RELEASE_VERSION_NAME" != "" ]; then
versionName=$CMLLIB_RELEASE_VERSION_NAME;
else
echo "Error: Specify version name"
exit
fi
baseDir=$(dirname "$0")
csprojCmlLib="${baseDir}/CmlLib/CmlLib.csproj"
csprojCmlLibCoreSample="${baseDir}/CmlLibCoreSample/CmlLibCoreSample.csproj"
csprojCmlLibWinFormSample="${baseDir}/CmlLibWinFormSample/CmlLibWinFormSample.csproj"
[ ! -f $csprojCmlLib ] && { echo "Cannot find CmlLib.csproj file"; exit; }
[ ! -f $csprojCmlLibCoreSample ] && { echo "Cannot find CmlLibCoreSample.csproj file"; exit; }
[ ! -f $csprojCmlLibWinFormSample ] && { echo "Cannot find CmlLibWinFormSample.csproj file"; exit; }
outDir="${baseDir}/release"
publishDir="${outDir}/CmlLib.Core.${versionName}"
sampleCoreLauncherDir="${outDir}/SampleCoreLauncher"
sampleWinFormLauncherDir="${outDir}/SampleWinFormLauncher"
if [ -d $outDir ]; then
rm -r $outDir || { echo "Failed to remove output directory: ${outDir}"; exit; }
fi
echo
echo "Packing nupkg file..."
dotnet pack "$csprojCmlLib" -o "$outDir" -c Release || exit;
echo
echo "Publishing CmlLibCoreSample project..."
dotnet publish "$csprojCmlLibCoreSample" -o "$sampleCoreLauncherDir" -c Release --no-self-contained || exit;
tar -zcvf "${sampleCoreLauncherDir}.tar.gz" "$sampleCoreLauncherDir"
rm -rf "${sampleCoreLauncherDir}"
echo
echo "Publishing CmlLibWinFormSample project..."
dotnet publish "$csprojCmlLibWinFormSample" -o "$sampleWinFormLauncherDir" -c Release --no-self-contained || exit;
tar -zcvf "${sampleWinFormSample}.tar.gz" "$sampleWinFormLauncherDir"
rm -rf "${sampleWinFormLauncherDir}"
echo
echo "Done"