aboutsummaryrefslogtreecommitdiffstats
path: root/bin/publish
blob: 57623a7a69f63b868bfb88e9f986c80f9c70d14c (plain) (blame)
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
#!/bin/bash
set -e

build=true
version_suffix=$(git rev-parse --short HEAD)

while test $# -gt 0; do
  case "$1" in
    -h|--help)
      echo 'options:'
      echo '-h, --help          show help'
      echo '--no-prebuild       skip build and test'
      echo '--runtime           a valid RID (https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)'
      echo '--version-suffix    version suffix for the binary. defaults to current git SHA'
      exit 0
      ;;
    --no-prebuild)
      build=false
      shift
      ;;
    --runtime*)
      shift
      runtime=$1
      shift
      ;;
    --version-suffix)
      shift
      version_suffix=$1
      shift
      ;;
    *)
      break
      ;;
  esac
done

if [ -z "$runtime" ]; then
    echo "error: no runtime specified; provide a valid RID (https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)"
    exit 1
fi

if [ "$build" == true ]; then
    echo $'\n> bin/build\n'
    bin/build
else
    echo $'\nbuild skipped\n'
fi

cd src/slskd
echo $'\n> pwd\n'
pwd

echo $'\n> dotnet publish ... --runtime '$runtime$' --version-suffix '$version_suffix$'\n'
rm -rf dist/$runtime/*
dotnet publish \
    --configuration Release \
    -p:PublishSingleFile=true \
    -p:ReadyToRun=true \
    -p:PublishTrimmed=true \
    -p:IncludeNativeLibrariesForSelfExtract=true \
    -p:CopyOutputSymbolsToPublishDirectory=false \
    --self-contained \
    --version-suffix $version_suffix \
    --runtime $runtime \
    --output ../../dist/$runtime

echo $'\npublish succeeded.'