Skip to content

Commit c813264

Browse files
committed
Add renaming and creation of file archives
1 parent 4e48c5b commit c813264

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

dotnet-publish.sh

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
cd "$(dirname "$0")"
33

4+
CURRENT_VERSION="1.0.0"
5+
46
if [ -d "./publish" ]; then
57
read -p "Delete ./publish directory [y/N]? " -r
68

@@ -24,9 +26,9 @@ dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration
2426
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/windows-x86-selfcontained --os win -a x86 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained &&
2527
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/windows-x64-selfcontained --os win -a x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained &&
2628

27-
# Mac
28-
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/osx-x64-selfcontained --os osx -a x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained &&
29-
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/osx-arm64-selfcontained --os osx -a arm64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained &&
29+
# Macos
30+
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/macos-x64-selfcontained --os osx -a x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained &&
31+
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/macos-arm64-selfcontained --os osx -a arm64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained &&
3032

3133
# Runtime Executables
3234

@@ -39,8 +41,29 @@ dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration
3941
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/windows-x86 --os win -a x86 /p:PublishSingleFile=true &&
4042
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/windows-x64 --os win -a x64 /p:PublishSingleFile=true &&
4143

42-
# Mac
43-
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/osx-x64 --os osx -a x64 /p:PublishSingleFile=true &&
44-
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/osx-arm64 --os osx -a arm64 /p:PublishSingleFile=true &&
44+
# Macos
45+
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/macos-x64 --os osx -a x64 /p:PublishSingleFile=true &&
46+
dotnet publish ./WireguardAllowedIPs/WireguardAllowedIPs.csproj --configuration Release -o ./publish/macos-arm64 --os osx -a arm64 /p:PublishSingleFile=true &&
47+
48+
echo "Done building!" &&
49+
50+
echo "Renaming and copying all binaries to ./publish" &&
51+
cd ./publish &&
52+
for dir in $(ls); do
53+
cp $dir/$(ls $dir -I "*.pdb") ./wg-ips-$dir$(ls $dir -I "*.pdb" | egrep -o '\..+$');
54+
done &&
55+
echo "Creating archives..." &&
56+
57+
# Linux
58+
tar -czf wg-ips-$CURRENT_VERSION-linux.tar.gz $(find . -maxdepth 1 -type f -regex '^.*linux.*$' | grep -v 'selfcontained') &&
59+
tar -czf wg-ips-$CURRENT_VERSION-linux-selfcontained.tar.gz $(find . -maxdepth 1 -type f -regex '^.*linux.*selfcontained.*$') &&
60+
61+
# Macos
62+
tar -czf wg-ips-$CURRENT_VERSION-macos.tar.gz $(find . -maxdepth 1 -type f -regex '^.*macos.*$' | grep -v 'selfcontained') &&
63+
tar -czf wg-ips-$CURRENT_VERSION-macos-selfcontained.tar.gz $(find . -maxdepth 1 -type f -regex '^.*macos.*selfcontained.*$') &&
64+
65+
# Windows
66+
zip wg-ips-$CURRENT_VERSION-windows.zip $(find . -maxdepth 1 -type f -regex '^.*windows.*$' | grep -v 'selfcontained') &&
67+
zip wg-ips-$CURRENT_VERSION-windows-selfcontained.zip $(find . -maxdepth 1 -type f -regex '^.*windows.*selfcontained.*$') &&
4568

46-
echo "Done!"
69+
echo "Done!"

0 commit comments

Comments
 (0)