-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·101 lines (77 loc) · 2.89 KB
/
publish.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#! /bin/bash
runWin=1
runOSX=1
runLinux=1
runZip=1
runNuGet=0
if [[ " $@ " =~ " nozip " ]]; then
runZip=0
fi
if [[ " $@ " =~ " win " ]]; then
runOSX=0
runLinux=0
runZip=0
fi
if [[ " $@ " =~ " osx " ]]; then
runWin=0
runLinux=0
runZip=0
fi
if [[ " $@ " =~ " linux " ]]; then
runWin=0
runOSX=0
runZip=0
fi
if [[ " $@ " =~ " nuget " ]]; then
runNuGet=1
fi
echo runWin: $runWin
echo runOSX: $runOSX
echo runLinux: $runLinux
echo runZip: $runZip
echo runNuGet: $runNuGet
set -x #echo on
mkdir -p ./publish/win-x64
rm -f ./publish/win-x64/*
mkdir -p ./publish/osx-x64
rm -f ./publish/osx-x64/*
mkdir -p ./publish/linux-x64
rm -f ./publish/linux-x64/*
mkdir -p ./publish/nuget
rm -f ./publish/nuget/*
rm -f ./publish/*.zip
rm -f ./MaxRunSoftware.Utilities/bin/Debug/*.nupkg
rm -f ./MaxRunSoftware.Utilities/bin/Release/*.nupkg
rm -f ./MaxRunSoftware.Utilities.External/bin/Debug/*.nupkg
rm -f ./MaxRunSoftware.Utilities.External/bin/Release/*.nupkg
rm -f ./MaxRunSoftware.Utilities.Console/bin/Debug/*.nupkg
rm -f ./MaxRunSoftware.Utilities.Console/bin/Release/*.nupkg
cd MaxRunSoftware.Utilities.Console
# Ignore warning NETSDK1179
# https://github.com/dotnet/sdk/issues/24269
if [[ $runWin = 1 ]]; then
dotnet publish -o ../publish/win-x64 -r win-x64 -p:PublishSingleFile=true --self-contained --nologo -p:PublishReadyToRunShowWarnings=true -p:PublishReadyToRun=false -p:IncludeAllContentForSelfExtract=true -p:DebugType=embedded
mv ../publish/win-x64/MaxRunSoftware.Utilities.Console.exe ../publish/win-x64/huc.exe
fi
if [[ $runOSX = 1 ]]; then
dotnet publish -o ../publish/osx-x64 -r osx-x64 -p:PublishSingleFile=true --self-contained --nologo -p:PublishReadyToRunShowWarnings=true -p:PublishReadyToRun=false -p:IncludeAllContentForSelfExtract=true -p:DebugType=embedded
mv ../publish/osx-x64/MaxRunSoftware.Utilities.Console ../publish/osx-x64/huc
fi
if [[ $runLinux = 1 ]]; then
dotnet publish -o ../publish/linux-x64 -r linux-x64 -p:PublishSingleFile=true --self-contained --nologo -p:PublishReadyToRunShowWarnings=true -p:PublishReadyToRun=false -p:IncludeAllContentForSelfExtract=true -p:DebugType=embedded
mv ../publish/linux-x64/MaxRunSoftware.Utilities.Console ../publish/linux-x64/huc
fi
cd ..
if [[ $runZip = 1 ]]; then
zip -9 -j ./publish/huc-win.zip ./publish/win-x64/huc.exe
zip -9 -j ./publish/huc-osx.zip ./publish/osx-x64/huc
zip -9 -j ./publish/huc-linux.zip ./publish/linux-x64/huc
zip -9 -j ./publish/libs.zip ./MaxRunSoftware.Utilities.External/bin/Debug/net6.0/*.* -x "ref"
fi
if [[ $runNuGet = 1 ]]; then
keyNuGet=$(<~/Keys/MaxRunSoftware_NuGet.txt)
find ./MaxRunSoftware.Utilities/bin/Debug -name '*.nupkg' -exec cp -prv '{}' './publish/nuget/' ';'
for filename in ./publish/nuget/*.nupkg; do
dotnet nuget push "$filename" --api-key $keyNuGet --source https://api.nuget.org/v3/index.json --skip-duplicate
done
fi