ci: add semantic-kernel packing.

This commit is contained in:
Yaohui Liu 2023-10-22 12:21:50 +08:00
parent f9a98c6e23
commit f2ec02737e
No known key found for this signature in database
GPG Key ID: E86D01E1809BD23E
1 changed files with 16 additions and 4 deletions

View File

@ -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