From f2ec02737e320263c1027c4fca22594db0a933da Mon Sep 17 00:00:00 2001 From: Yaohui Liu Date: Sun, 22 Oct 2023 12:21:50 +0800 Subject: [PATCH] ci: add semantic-kernel packing. --- .github/prepare_release.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/prepare_release.sh b/.github/prepare_release.sh index 5f3a785b..67a09eac 100644 --- a/.github/prepare_release.sh +++ b/.github/prepare_release.sh @@ -6,7 +6,8 @@ echo "is_minor: $is_minor" echo "is_patch: $is_patch" if [ "$is_minor" = true ] && [ "$is_patch" = true ]; then - echo "Only one of minor version and patch version should be specified to increase." + type="minor_patch" + echo "When both minor version and patch version are specified, the minor version will increase and patch version becomes 0." elif [ "$is_minor" = true ] && [ "$is_patch" = false ]; then type="minor" echo "dicided to update minor version" @@ -38,21 +39,32 @@ elif [[ $type == "patch" ]]; then echo "Invalid version format" exit 1 fi +elif [[ $type == "minor_patch" ]]; then + regex="[0-9]+\.([0-9]+)\.[0-9]+$" + if [[ $version =~ $regex ]]; then + b="${BASH_REMATCH[1]}" + b=$((b + 1)) # 将 B 值加 1 + updated_version="${version%.*}.$b.0" # 构建更新后的版本号 + echo "Updated version: $updated_version" + else + echo "Invalid version format" exit 1 + fi else echo "Invalid type" exit 1 fi -# preparation before building backends +# preparation before packing backends mkdir ./temp mkdir ./temp/runtimes cp ./LLama/runtimes/*.* ./temp/runtimes/ cp -r ./LLama/runtimes/build ./temp/ -# build the main package +# pack the main package dotnet pack ./LLama/LLamaSharp.csproj -c Release -o ./temp/ /p:PackageVersion=$updated_version /p:Version=$updated_version; +dotnet pack ./LLama.SemanticKernel/LLamaSharp.csproj -c Release -o ./temp/ /p:PackageVersion=$updated_version /p:Version=$updated_version; -# build the backends +# pack the backends cd temp nuget pack LLamaSharp.Backend.Cpu.nuspec -version $updated_version nuget pack LLamaSharp.Backend.Cuda11.nuspec -version $updated_version