-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathbuild-package.sh
More file actions
executable file
·64 lines (54 loc) · 1.59 KB
/
build-package.sh
File metadata and controls
executable file
·64 lines (54 loc) · 1.59 KB
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
#!/bin/bash
# Exit on error
set -e
# Default configuration
CONFIG="Release"
SOLUTION="Serilog.Sinks.Datadog.Logs.sln"
OUTPUT_DIR="artifacts"
PROJECT_DIR="src/Serilog.Sinks.Datadog.Logs"
# Process arguments
while [[ $# -gt 0 ]]; do
case $1 in
--config|-c)
CONFIG="$2"
shift 2
;;
--solution|-s)
SOLUTION="$2"
shift 2
;;
--output|-o)
OUTPUT_DIR="$2"
shift 2
;;
--help|-h)
echo "Usage: $(basename "$0") [options]"
echo "Options:"
echo " --config, -c CONFIG Build configuration (Debug/Release, default: Release)"
echo " --solution, -s SOLUTION Solution file to build (default: Serilog.Sinks.Datadog.Logs.sln)"
echo " --output, -o DIR Output directory for packages (default: artifacts)"
echo " --help, -h Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Create output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"
echo "Building package with configuration: $CONFIG"
echo "Solution: $SOLUTION"
echo "Output directory: $OUTPUT_DIR"
# Step 1: Restore packages
echo "Restoring packages..."
dotnet msbuild "$SOLUTION" /t:restore /p:Configuration="$CONFIG"
# Step 2: Build solution
echo "Building solution..."
dotnet msbuild "$SOLUTION" /p:Configuration="$CONFIG"
# Step 3: Create NuGet package
echo "Creating NuGet package..."
dotnet msbuild "$SOLUTION" /t:pack /p:Configuration="$CONFIG" /p:PackageOutputPath="$OUTPUT_DIR"
echo "Build completed successfully!"
echo "Packages are available in: $PROJECT_DIR/$OUTPUT_DIR"