diff --git a/publish-nix.sh b/publish-nix.sh index ef0654ec..ff535683 100755 --- a/publish-nix.sh +++ b/publish-nix.sh @@ -11,11 +11,12 @@ # Optional parameters USE_ALL=false INCLUDE_DEBUG=false +INCLUDE_RELEASE=false NO_BUILD=false NO_ARCHIVE=false HAS_VERSION=false VERSION="NONE" -while getopts "udbav:" OPTION; do +while getopts "udrbav:" OPTION; do case $OPTION in u) USE_ALL=true @@ -23,6 +24,9 @@ while getopts "udbav:" OPTION; do d) INCLUDE_DEBUG=true ;; + r) + INCLUDE_RELEASE=true + ;; b) NO_BUILD=true ;; @@ -50,6 +54,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 " No build (-b) $NO_BUILD" echo " No archive (-a) $NO_ARCHIVE" echo " Version (-v) $HAS_VERSION ($VERSION)" @@ -107,13 +112,21 @@ if [ $NO_BUILD = false ]; then if [ $INCLUDE_DEBUG = true ]; then dotnet publish ProtectionScan/ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true fi - dotnet publish ProtectionScan/ProtectionScan.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 ProtectionScan/ProtectionScan.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 ProtectionScan/ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT fi - dotnet publish ProtectionScan/ProtectionScan.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 ProtectionScan/ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + fi fi done done @@ -152,11 +165,15 @@ if [ $NO_ARCHIVE = false ]; then zip -r $BUILD_FOLDER/ProtectionScan_${FRAMEWORK}_${RUNTIME}_debug.zip . fi fi - cd $BUILD_FOLDER/ProtectionScan/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ - if [ $HAS_VERSION = true ]; then - zip -r $BUILD_FOLDER/ProtectionScan_${VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip . - else - zip -r $BUILD_FOLDER/ProtectionScan_${FRAMEWORK}_${RUNTIME}_release.zip . + + # Only include Release if set + if [ $INCLUDE_RELEASE = true ]; then + cd $BUILD_FOLDER/ProtectionScan/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/ + if [ $HAS_VERSION = true ]; then + zip -r $BUILD_FOLDER/ProtectionScan_${VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip . + else + zip -r $BUILD_FOLDER/ProtectionScan_${FRAMEWORK}_${RUNTIME}_release.zip . + fi fi done done diff --git a/publish-win.ps1 b/publish-win.ps1 index 7f33956b..6a5b10e3 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("NoBuild")] [switch]$NO_BUILD, @@ -37,11 +41,12 @@ $COMMIT = git log --pretty=format:"%H" -1 # Output the selected options Write-Host "Selected Options:" -Write-Host " Use all frameworks (-UseAll) $USE_ALL" -Write-Host " Include debug builds (-IncludeDebug) $INCLUDE_DEBUG" -Write-Host " No build (-NoBuild) $NO_BUILD" -Write-Host " No archive (-NoArchive) $NO_ARCHIVE" -Write-Host " Version (-BuildVersion) $BUILD_VERSION" +Write-Host " Use all frameworks (-UseAll) $USE_ALL" +Write-Host " Include debug builds (-IncludeDebug) $INCLUDE_DEBUG" +Write-Host " Include release builds (-IncludeRelease) $INCLUDE_RELEASE" +Write-Host " No build (-NoBuild) $NO_BUILD" +Write-Host " No archive (-NoArchive) $NO_ARCHIVE" +Write-Host " Version (-BuildVersion) $BUILD_VERSION" Write-Host " " # Create the build matrix arrays @@ -92,14 +97,22 @@ if (!$NO_BUILD.IsPresent) { if ($INCLUDE_DEBUG.IsPresent) { dotnet publish ProtectionScan\ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true } - dotnet publish ProtectionScan\ProtectionScan.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 ProtectionScan\ProtectionScan.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 ProtectionScan\ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT } - dotnet publish ProtectionScan\ProtectionScan.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 ProtectionScan\ProtectionScan.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false + } } } } @@ -135,13 +148,16 @@ if (!$NO_ARCHIVE.IsPresent) { 7z a -tzip $BUILD_FOLDER\ProtectionScan_${FRAMEWORK}_${RUNTIME}_debug.zip * } } - - Set-Location -Path $BUILD_FOLDER\ProtectionScan\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ - if ($BUILD_VERSION -ne $null) { - 7z a -tzip $BUILD_FOLDER\ProtectionScan_${BUILD_VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip * - } - else { - 7z a -tzip $BUILD_FOLDER\ProtectionScan_${FRAMEWORK}_${RUNTIME}_release.zip * + + # Only include Release if set + if ($INCLUDE_RELEASE.IsPresent) { + Set-Location -Path $BUILD_FOLDER\ProtectionScan\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\ + if ($BUILD_VERSION -ne $null) { + 7z a -tzip $BUILD_FOLDER\ProtectionScan_${BUILD_VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip * + } + else { + 7z a -tzip $BUILD_FOLDER\ProtectionScan_${FRAMEWORK}_${RUNTIME}_release.zip * + } } } }