2024-01-06 08:58:12 +08:00
|
|
|
|
#!/bin/bash -e
|
2023-10-22 16:38:38 +08:00
|
|
|
|
|
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;
|
2024-01-06 09:13:26 +08:00
|
|
|
|
cp ./LLama/runtimes ./temp -R;
|
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
|
2024-01-06 09:04:07 +08:00
|
|
|
|
echo "Invalid version format"
|
|
|
|
|
exit 1
|
2023-10-22 11:52:56 +08:00
|
|
|
|
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
|
2023-11-12 14:54:43 +08:00
|
|
|
|
echo "Invalid type"
|
2023-10-22 11:52:56 +08:00
|
|
|
|
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-11-12 14:54:43 +08:00
|
|
|
|
dotnet pack ./LLama.KernelMemory/LLamaSharp.KernelMemory.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
|
2024-02-05 19:16:49 +08:00
|
|
|
|
for nuspec in *.nuspec
|
|
|
|
|
do
|
|
|
|
|
echo "Packing $nuspec"
|
|
|
|
|
nuget pack $nuspec -version $updated_version
|
|
|
|
|
done
|
2023-10-22 11:52:56 +08:00
|
|
|
|
|
2024-03-31 21:08:43 +08:00
|
|
|
|
# write the version to the file
|
|
|
|
|
echo $updated_version > version.txt
|
|
|
|
|
|
2023-10-22 11:52:56 +08:00
|
|
|
|
cd ..
|
2023-10-22 17:50:37 +08:00
|
|
|
|
exit 0
|