From e3640a937699d11c3fb053bda7134efef20b4d8e Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 13 Nov 2026 14:00:53 +0100 Subject: [PATCH] Make release builds a separate flag in publish scripts --- publish-nix.sh | 59 +++++++++++++++++++++++++++++++++------------ publish-win.ps1 | 63 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 89 insertions(+), 33 deletions(-) diff --git a/publish-nix.sh b/publish-nix.sh index a87009c1..eb597e82 100755 --- a/publish-nix.sh +++ b/publish-nix.sh @@ -11,12 +11,13 @@ # Optional parameters USE_ALL=false INCLUDE_DEBUG=false +INCLUDE_RELEASE=false INCLUDE_UNPUBLISHED=false NO_BUILD=false NO_ARCHIVE=false HAS_VERSION=false VERSION="NONE" -while getopts "udpbav:" OPTION; do +while getopts "udrpbav:" OPTION; do case $OPTION in u) USE_ALL=true @@ -24,6 +25,9 @@ while getopts "udpbav:" OPTION; do d) INCLUDE_DEBUG=true ;; + r) + INCLUDE_RELEASE=true + ;; p) INCLUDE_UNPUBLISHED=true ;; @@ -54,6 +58,7 @@ COMMIT=$(git log --pretty=%H -1) echo "Selected Options:" echo " Use all frameworks (-u) $USE_ALL" echo " Include debug builds (-d) $INCLUDE_DEBUG" +echo " Include release builds (-r) $INCLUDE_RELEASE" echo " Include unpublished packages (-p) $INCLUDE_UNPUBLISHED" echo " No build (-b) $NO_BUILD" echo " No archive (-a) $NO_ARCHIVE" @@ -127,13 +132,21 @@ if [ $NO_BUILD = false ]; then if [ $INCLUDE_DEBUG = true ]; then dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true fi - dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + + # Only include Release if set + if [ $INCLUDE_RELEASE = true ]; then + dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + fi else # Only include Debug if set if [ $INCLUDE_DEBUG = true ]; then dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT fi - dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + + # Only include Release if set + if [ $INCLUDE_RELEASE = true ]; then + dotnet publish ExtractionTool/ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + fi fi done done @@ -166,13 +179,21 @@ if [ $NO_BUILD = false ]; then if [ $INCLUDE_DEBUG = true ]; then dotnet publish InfoPrint/InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true fi - dotnet publish InfoPrint/InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + + # Only include Release if set + if [ $INCLUDE_RELEASE = true ]; then + dotnet publish InfoPrint/InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + fi else # Only include Debug if set if [ $INCLUDE_DEBUG = true ]; then dotnet publish InfoPrint/InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT fi - dotnet publish InfoPrint/InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + + # Only include Release if set + if [ $INCLUDE_RELEASE = true ]; then + dotnet publish InfoPrint/InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + fi fi done done @@ -211,11 +232,15 @@ if [ $NO_ARCHIVE = false ]; then zip -r $BUILD_FOLDER/ExtractionTool_${FRAMEWORK}_${RUNTIME}_debug.zip . fi fi - cd $BUILD_FOLDER/ExtractionTool/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ - if [ $HAS_VERSION = true ]; then - zip -r $BUILD_FOLDER/ExtractionTool_${VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip . - else - zip -r $BUILD_FOLDER/ExtractionTool_${FRAMEWORK}_${RUNTIME}_release.zip . + + # Only include Release if set + if [ $INCLUDE_RELEASE = true ]; then + cd $BUILD_FOLDER/ExtractionTool/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ + if [ $HAS_VERSION = true ]; then + zip -r $BUILD_FOLDER/ExtractionTool_${VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip . + else + zip -r $BUILD_FOLDER/ExtractionTool_${FRAMEWORK}_${RUNTIME}_release.zip . + fi fi done done @@ -251,11 +276,15 @@ if [ $NO_ARCHIVE = false ]; then zip -r $BUILD_FOLDER/InfoPrint_${FRAMEWORK}_${RUNTIME}_debug.zip . fi fi - cd $BUILD_FOLDER/InfoPrint/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ - if [ $HAS_VERSION = true ]; then - zip -r $BUILD_FOLDER/InfoPrint_${VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip . - else - zip -r $BUILD_FOLDER/InfoPrint_${FRAMEWORK}_${RUNTIME}_release.zip . + + # Only include Release if set + if [ $INCLUDE_RELEASE = true ]; then + cd $BUILD_FOLDER/InfoPrint/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ + if [ $HAS_VERSION = true ]; then + zip -r $BUILD_FOLDER/InfoPrint_${VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip . + else + zip -r $BUILD_FOLDER/InfoPrint_${FRAMEWORK}_${RUNTIME}_release.zip . + fi fi done done diff --git a/publish-win.ps1 b/publish-win.ps1 index 80b886c7..5686ecc4 100644 --- a/publish-win.ps1 +++ b/publish-win.ps1 @@ -16,6 +16,10 @@ param( [Alias("IncludeDebug")] [switch]$INCLUDE_DEBUG, + [Parameter(Mandatory = $false)] + [Alias("IncludeRelease")] + [switch]$INCLUDE_RELEASE, + [Parameter(Mandatory = $false)] [Alias("IncludeUnpublished")] [switch]$INCLUDE_UNPUBLISHED, @@ -43,10 +47,11 @@ $COMMIT = git log --pretty=format:"%H" -1 Write-Host "Selected Options:" Write-Host " Use all frameworks (-UseAll) $USE_ALL" Write-Host " Include debug builds (-IncludeDebug) $INCLUDE_DEBUG" -Write-Host " Include unpublished packages (-IncludeUnpublished) $INCLUDE_DEBUG" +Write-Host " Include release builds (-IncludeRelease) $INCLUDE_RELEASE" +Write-Host " Include unpublished packages (-IncludeUnpublished) $INCLUDE_UNPUBLISHED" Write-Host " No build (-NoBuild) $NO_BUILD" Write-Host " No archive (-NoArchive) $NO_ARCHIVE" -Write-Host " Version (-BuildVersion) $BUILD_VERSION" +Write-Host " Version (-BuildVersion) $BUILD_VERSION" Write-Host " " # Create the build matrix arrays @@ -112,14 +117,22 @@ if (!$NO_BUILD.IsPresent) { if ($INCLUDE_DEBUG.IsPresent) { dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true } - dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + + # Only include Release if set + if ($INCLUDE_RELEASE.IsPresent) { + dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + } } else { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT } - dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + + # Only include Release if set + if ($INCLUDE_RELEASE.IsPresent) { + dotnet publish ExtractionTool\ExtractionTool.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + } } } } @@ -148,14 +161,22 @@ if (!$NO_BUILD.IsPresent) { if ($INCLUDE_DEBUG.IsPresent) { dotnet publish InfoPrint\InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true } - dotnet publish InfoPrint\InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + + # Only include Release if set + if ($INCLUDE_RELEASE.IsPresent) { + dotnet publish InfoPrint\InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false + } } else { # Only include Debug if set if ($INCLUDE_DEBUG.IsPresent) { dotnet publish InfoPrint\InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT } - dotnet publish InfoPrint\InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + + # Only include Release if set + if ($INCLUDE_RELEASE.IsPresent) { + dotnet publish InfoPrint\InfoPrint.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + } } } } @@ -192,12 +213,15 @@ if (!$NO_ARCHIVE.IsPresent) { } } - Set-Location -Path $BUILD_FOLDER\ExtractionTool\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ - if ($BUILD_VERSION -ne $null) { - 7z a -tzip $BUILD_FOLDER\ExtractionTool_${BUILD_VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip * - } - else { - 7z a -tzip $BUILD_FOLDER\ExtractionTool_${FRAMEWORK}_${RUNTIME}_release.zip * + # Only include Release if set + if ($INCLUDE_RELEASE.IsPresent) { + Set-Location -Path $BUILD_FOLDER\ExtractionTool\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ + if ($BUILD_VERSION -ne $null) { + 7z a -tzip $BUILD_FOLDER\ExtractionTool_${BUILD_VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip * + } + else { + 7z a -tzip $BUILD_FOLDER\ExtractionTool_${FRAMEWORK}_${RUNTIME}_release.zip * + } } } } @@ -231,12 +255,15 @@ if (!$NO_ARCHIVE.IsPresent) { } } - Set-Location -Path $BUILD_FOLDER\InfoPrint\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ - if ($BUILD_VERSION -ne $null) { - 7z a -tzip $BUILD_FOLDER\InfoPrint_${BUILD_VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip * - } - else { - 7z a -tzip $BUILD_FOLDER\InfoPrint_${FRAMEWORK}_${RUNTIME}_release.zip * + # Only include Release if set + if ($INCLUDE_RELEASE.IsPresent) { + Set-Location -Path $BUILD_FOLDER\InfoPrint\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ + if ($BUILD_VERSION -ne $null) { + 7z a -tzip $BUILD_FOLDER\InfoPrint_${BUILD_VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip * + } + else { + 7z a -tzip $BUILD_FOLDER\InfoPrint_${FRAMEWORK}_${RUNTIME}_release.zip * + } } } }