2023-10-22 16:38:38 +08:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
2023-10-22 15:23:10 +08:00
|
|
|
|
is_minor="$1" # type is "minor" or "patch"
|
|
|
|
|
is_patch="$2" # type is "minor" or "patch"
|
2023-10-22 11:52:56 +08:00
|
|
|
|
|
|
|
|
|
echo "is_minor: $is_minor"
|
|
|
|
|
echo "is_patch: $is_patch"
|
|
|
|
|
|
|
|
|
|
if [ "$is_minor" = true ] && [ "$is_patch" = true ]; then
|
2023-10-22 17:45:07 +08:00
|
|
|
|
echo "Only one of minor version and patch version should be specified."
|
|
|
|
|
exit 1
|
2023-10-22 11:52:56 +08:00
|
|
|
|
elif [ "$is_minor" = true ] && [ "$is_patch" = false ]; then
|
|
|
|
|
type="minor"
|
2023-10-22 18:40:09 +08:00
|
|
|
|
echo "decided to update minor version"
|
2023-10-22 11:52:56 +08:00
|
|
|
|
elif [ "$is_minor" = false ] && [ "$is_patch" = true ]; then
|
|
|
|
|
type="patch"
|
2023-10-22 18:40:09 +08:00
|
|
|
|
echo "decided to update patch version"
|
2023-10-22 11:52:56 +08:00
|
|
|
|
else
|
|
|
|
|
echo "At least one of minor version and patch version should be specified."
|
2023-10-22 17:04:56 +08:00
|
|
|
|
exit 1
|
2023-10-22 11:52:56 +08:00
|
|
|
|
fi
|
|
|
|
|
|
2023-10-22 15:44:50 +08:00
|
|
|
|
mkdir ./temp;
|
|
|
|
|
mkdir ./temp/runtimes;
|
2023-11-11 20:12:07 +08:00
|
|
|
|
# For sure it could be done better but cp -R did not work on osx
|
|
|
|
|
mkdir ./temp/runtimes/osx-arm64
|
|
|
|
|
mkdir ./temp/runtimes/osx-x64
|
|
|
|
|
cp ./LLama/runtimes/*.* ./temp/runtimes/;
|
|
|
|
|
cp ./LLama/runtimes/osx-arm64/*.* ./temp/runtimes/osx-arm64/;
|
|
|
|
|
cp ./LLama/runtimes/osx-x64/*.* ./temp/runtimes/osx-x64;
|
2023-10-22 16:35:25 +08:00
|
|
|
|
cp ./LLama/runtimes/build/*.* ./temp/;
|
2023-10-22 15:23:10 +08:00
|
|
|
|
|
|
|
|
|
# get the current version
|
2023-10-22 15:44:50 +08:00
|
|
|
|
cd temp;
|
|
|
|
|
dotnet add package LLamaSharp;
|
|
|
|
|
version=$(dotnet list temp.csproj package | grep LLamaSharp);
|
2023-11-11 20:12:07 +08:00
|
|
|
|
# TODO: This didn´t work on osx...we need a solution
|
2023-10-22 17:04:56 +08:00
|
|
|
|
read -ra arr <<< "$version"
|
|
|
|
|
version="${arr[-1]}"
|
|
|
|
|
echo "The latest version: $version";
|
|
|
|
|
|
2023-10-22 15:23:10 +08:00
|
|
|
|
|
|
|
|
|
# update the version
|
2023-10-22 11:52:56 +08:00
|
|
|
|
if [[ $type == "minor" ]]; then
|
|
|
|
|
regex="[0-9]+\.([0-9]+)\.[0-9]+$"
|
|
|
|
|
if [[ $version =~ $regex ]]; then
|
|
|
|
|
b="${BASH_REMATCH[1]}"
|
2023-10-22 17:45:07 +08:00
|
|
|
|
b=$((b + 1))
|
|
|
|
|
updated_version="${version%%.*}.$b.0"
|
2023-10-22 11:52:56 +08:00
|
|
|
|
echo "Updated version: $updated_version"
|
|
|
|
|
else
|
|
|
|
|
echo "Invalid version format" exit 1
|
|
|
|
|
fi
|
|
|
|
|
elif [[ $type == "patch" ]]; then
|
|
|
|
|
regex="([0-9]+)$"
|
|
|
|
|
if [[ $version =~ $regex ]]; then
|
|
|
|
|
c="${BASH_REMATCH[1]}"
|
2023-10-22 17:45:07 +08:00
|
|
|
|
c=$((c + 1))
|
|
|
|
|
updated_version="${version%.*}.$c"
|
2023-10-22 11:52:56 +08:00
|
|
|
|
echo "Updated version: $updated_version"
|
|
|
|
|
else
|
|
|
|
|
echo "Invalid version format"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "Invalid type"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2023-10-22 17:04:56 +08:00
|
|
|
|
cd ..
|
2023-10-22 12:21:50 +08:00
|
|
|
|
# pack the main package
|
2023-10-22 11:52:56 +08:00
|
|
|
|
dotnet pack ./LLama/LLamaSharp.csproj -c Release -o ./temp/ /p:PackageVersion=$updated_version /p:Version=$updated_version;
|
2023-10-22 17:04:56 +08:00
|
|
|
|
dotnet pack ./LLama.SemanticKernel/LLamaSharp.SemanticKernel.csproj -c Release -o ./temp/ /p:PackageVersion=$updated_version /p:Version=$updated_version;
|
2023-10-22 11:52:56 +08:00
|
|
|
|
|
2023-10-22 12:21:50 +08:00
|
|
|
|
# pack the backends
|
2023-10-22 11:52:56 +08:00
|
|
|
|
cd temp
|
|
|
|
|
nuget pack LLamaSharp.Backend.Cpu.nuspec -version $updated_version
|
|
|
|
|
nuget pack LLamaSharp.Backend.Cuda11.nuspec -version $updated_version
|
|
|
|
|
nuget pack LLamaSharp.Backend.Cuda12.nuspec -version $updated_version
|
2023-11-08 05:07:08 +08:00
|
|
|
|
|
2023-10-22 11:52:56 +08:00
|
|
|
|
|
|
|
|
|
cd ..
|
2023-10-22 17:50:37 +08:00
|
|
|
|
exit 0
|