Enable versions in publish script

This commit is contained in:
Matt Nadareski
2026-09-21 09:10:04 -04:00
parent b117ba68aa
commit 9b7c9ec0e4
2 changed files with 36 additions and 6 deletions

View File

@@ -13,7 +13,9 @@ USE_ALL=false
INCLUDE_DEBUG=false
NO_BUILD=false
NO_ARCHIVE=false
while getopts "udba" OPTION; do
HAS_VERSION=false
VERSION="NONE"
while getopts "udbav:" OPTION; do
case $OPTION in
u)
USE_ALL=true
@@ -27,6 +29,10 @@ while getopts "udba" OPTION; do
a)
NO_ARCHIVE=true
;;
v)
HAS_VERSION=true
VERSION=${OPTARG}
;;
*)
echo "Invalid option provided"
exit 1
@@ -46,6 +52,7 @@ echo " Use all frameworks (-u) $USE_ALL"
echo " Include debug builds (-d) $INCLUDE_DEBUG"
echo " No build (-b) $NO_BUILD"
echo " No archive (-a) $NO_ARCHIVE"
echo " Version (-v) $HAS_VERSION ($VERSION)"
echo " "
# Create the build matrix arrays
@@ -139,10 +146,18 @@ if [ $NO_ARCHIVE = false ]; then
# Only include Debug if set
if [ $INCLUDE_DEBUG = true ]; then
cd $BUILD_FOLDER/NDecrypt/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/
zip -r $BUILD_FOLDER/NDecrypt_${FRAMEWORK}_${RUNTIME}_debug.zip .
if [ $HAS_VERSION = true ]; then
zip -r $BUILD_FOLDER/NDecrypt_${VERSION}_${FRAMEWORK}_${RUNTIME}_debug.zip .
else
zip -r $BUILD_FOLDER/NDecrypt_${FRAMEWORK}_${RUNTIME}_debug.zip .
fi
fi
cd $BUILD_FOLDER/NDecrypt/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/
zip -r $BUILD_FOLDER/NDecrypt_${FRAMEWORK}_${RUNTIME}_release.zip .
if [ $HAS_VERSION = true ]; then
zip -r $BUILD_FOLDER/NDecrypt_${VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip .
else
zip -r $BUILD_FOLDER/NDecrypt_${FRAMEWORK}_${RUNTIME}_release.zip .
fi
done
done

View File

@@ -22,7 +22,11 @@ param(
[Parameter(Mandatory = $false)]
[Alias("NoArchive")]
[switch]$NO_ARCHIVE
[switch]$NO_ARCHIVE,
[Parameter(Mandatory = $false, ValueFromPipeline = $true)]
[Alias("BuildVersion")]
[string]$BUILD_VERSION
)
# Set the current directory as a variable
@@ -37,6 +41,7 @@ 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 " "
# Create the build matrix arrays
@@ -123,11 +128,21 @@ if (!$NO_ARCHIVE.IsPresent) {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
Set-Location -Path $BUILD_FOLDER\NDecrypt\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
7z a -tzip $BUILD_FOLDER\NDecrypt_${FRAMEWORK}_${RUNTIME}_debug.zip *
if ($BUILD_VERSION -ne $null) {
7z a -tzip $BUILD_FOLDER\NDecrypt_${BUILD_VERSION}_${FRAMEWORK}_${RUNTIME}_debug.zip *
}
else {
7z a -tzip $BUILD_FOLDER\NDecrypt_${FRAMEWORK}_${RUNTIME}_debug.zip *
}
}
Set-Location -Path $BUILD_FOLDER\NDecrypt\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
7z a -tzip $BUILD_FOLDER\NDecrypt_${FRAMEWORK}_${RUNTIME}_release.zip *
if ($BUILD_VERSION -ne $null) {
7z a -tzip $BUILD_FOLDER\NDecrypt_${BUILD_VERSION}_${FRAMEWORK}_${RUNTIME}_release.zip *
}
else {
7z a -tzip $BUILD_FOLDER\NDecrypt_${FRAMEWORK}_${RUNTIME}_release.zip *
}
}
}