-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·82 lines (65 loc) · 2.16 KB
/
Copy pathpublish.sh
File metadata and controls
executable file
·82 lines (65 loc) · 2.16 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# Build script for AddPdfEnvelope - creates self-contained single-file executables
# for Windows, macOS, and Linux (both x64 and ARM64)
set -e
PUBLISH_DIR="publish"
PROJECT_NAME="AddPdfEnvelope"
PROJECT_FILE="${PROJECT_NAME}.csproj"
# Runtime identifiers for all target platforms
RIDS=(
"win-x64"
"win-arm64"
"osx-x64"
"osx-arm64"
"linux-x64"
"linux-arm64"
)
# Clean up previous publish folder
echo "Cleaning up previous publish folder..."
rm -rf "$PUBLISH_DIR"
mkdir -p "$PUBLISH_DIR"
# Build and publish for each platform
for RID in "${RIDS[@]}"; do
echo ""
echo "=========================================="
echo "Building for $RID..."
echo "=========================================="
OUTPUT_DIR="$PUBLISH_DIR/$RID"
dotnet publish "$PROJECT_FILE" -c Release \
-r "$RID" \
--self-contained true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-o "$OUTPUT_DIR"
# Remove unnecessary files (keep only executables and required files)
echo "Cleaning up $RID output..."
# Determine executable name based on platform
if [[ "$RID" == win-* ]]; then
EXE_NAME="$PROJECT_NAME.exe"
else
EXE_NAME="$PROJECT_NAME"
fi
# Create ZIP file
echo "Creating ZIP for $RID..."
ZIP_NAME="${PROJECT_NAME}-${RID}.zip"
pushd "$OUTPUT_DIR" > /dev/null
# Remove PDB files and other unnecessary files
rm -f *.pdb
rm -f *.deps.json
rm -f *.runtimeconfig.json
# Create ZIP containing all remaining files
if command -v zip &> /dev/null; then
zip -r "../$ZIP_NAME" .
else
# Fallback to tar if zip is not available
tar -czvf "../${PROJECT_NAME}-${RID}.tar.gz" .
echo "Note: 'zip' command not found, created .tar.gz instead"
fi
popd > /dev/null
echo "Created: $PUBLISH_DIR/$ZIP_NAME"
done
echo ""
echo "=========================================="
echo "Build complete! Output in $PUBLISH_DIR/"
echo "=========================================="
ls -la "$PUBLISH_DIR"/*.zip 2>/dev/null || ls -la "$PUBLISH_DIR"/*.tar.gz 2>/dev/null