Spaces:
Running
Running
File size: 2,076 Bytes
b110593 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
#!/usr/bin/env bash
set -eou pipefail
VERSION=${1-}
function echo_green() {
green='\033[0;32m'
nc='\033[0m'
echo -e "${green}${*}${nc}"
}
function echo_red() {
red='\033[0;31m'
nc='\033[0m'
echo -e "${red}${*}${nc}"
}
function echo_purp_bold() {
purp='\033[1;35m'
nc='\033[0m'
echo -e "${purp}${*}${nc}"
}
function check_binary_files_existance() {
FILES=("binaries-windows-amd64.zip" "binaries-windows-arm64.zip")
for f in "${FILES[@]}"
do
if [ ! -f "$f" ]; then
echo_red "File $f does not exist."
echo_red "This script expects binaries-windows-amd64.zip and binaries-windows-arm64.zip files to be present."
echo_red "Before running it please first download windows binaries files from github CI pipeline"
echo_red "so that this script can properly modify the names of the files and generate checksums."
exit 1
fi
done
}
function calculate_checksums() {
shasum -a 256 $1 | cut -d ' ' -f 1 > $1.sha256
md5 $1 | cut -d ' ' -f 4 > $1.md5
}
function prepare_binary() {
arch=$1
arch_dir=$arch
mkdir $arch_dir && mv binaries-windows-$arch.zip $arch_dir && cd $arch_dir
unzip binaries-windows-$arch.zip
cp ../../../../README.md .
cp ../../../../LICENSE .
zip weaviate-$VERSION-windows-$arch.zip weaviate.exe LICENSE README.md
calculate_checksums weaviate-$VERSION-windows-$arch.zip
rm weaviate.exe
mv weaviate* ../
cd .. && rm -fr $arch_dir
}
function main() {
if test -z "$VERSION"; then
echo "Missing version parameter. Usage: $0 VERSION"
exit 1
fi
if case $VERSION in v*) false;; esac; then
VERSION="v$VERSION"
fi
check_binary_files_existance
OUT_DIR="dist"
if [ -d $OUT_DIR ]; then
rm -fr $OUT_DIR
fi
ARCHITECTURES=("amd64" "arm64")
for arch in "${ARCHITECTURES[@]}"
do
prepare_binary $arch
done
mkdir $OUT_DIR && mv weaviate* $OUT_DIR
echo_purp_bold "${VERSION} windows artifacts available here: $(pwd)/$OUT_DIR"
}
main "$@"
|