From ed832ce3b7d15c1ff8a7038a0e88669942a9c3d9 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Fri, 28 Jul 2023 12:38:48 -0400 Subject: [PATCH] darwin build script --- scripts/build.sh | 7 ------- scripts/build_darwin.sh | 18 ++++++++++++++++++ scripts/publish.sh | 13 ++----------- 3 files changed, 20 insertions(+), 18 deletions(-) delete mode 100755 scripts/build.sh create mode 100755 scripts/build_darwin.sh diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100755 index 4c19da95..00000000 --- a/scripts/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -mkdir -p dist -CGO_ENABLED=1 GOARCH=arm64 go build -o dist/ollama_arm64 -CGO_ENABLED=1 GOARCH=amd64 go build -o dist/ollama_amd64 -lipo -create -output dist/ollama dist/ollama_arm64 dist/ollama_amd64 -npm run --prefix app make:sign diff --git a/scripts/build_darwin.sh b/scripts/build_darwin.sh new file mode 100755 index 00000000..1d2e53e4 --- /dev/null +++ b/scripts/build_darwin.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +mkdir -p dist + +# build and sign the universal binary +CGO_ENABLED=1 GOARCH=arm64 go build -o dist/ollama_arm64 +CGO_ENABLED=1 GOARCH=amd64 go build -o dist/ollama_amd64 +lipo -create -output dist/ollama dist/ollama_arm64 dist/ollama_amd64 +rm dist/ollama_amd64 dist/ollama_arm64 +codesign --deep --force --options=runtime --sign "$APPLE_IDENTITY" --timestamp ./dist/ollama +xcrun altool --notarize-app --username="$APPLE_ID" --password "$APPLE_PASSWORD" --file ./dist/ollama + +# build and sign the mac app +npm run --prefix app make:sign +cp app/out/make/zip/darwin/universal/Ollama-darwin-universal-${VERSION:-0.0.0}.zip dist/Ollama-darwin.zip + +# rename the cli after its been packaged +mv dist/ollama dist/ollama-darwin diff --git a/scripts/publish.sh b/scripts/publish.sh index 84eb2730..5bf15dcb 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -8,9 +8,8 @@ if [[ -z "${VERSION}" ]]; then fi OS=$(go env GOOS) -ARCH=$(go env GOARCH) -./script/build.sh +./script/build_${OS}.sh # Create a new tag if it doesn't exist. if ! git rev-parse v$VERSION >/dev/null 2>&1; then @@ -19,16 +18,8 @@ fi git push origin v$VERSION -mkdir -p dist -cp app/out/make/zip/${OS}/${ARCH}/Ollama-${OS}-${ARCH}-${VERSION}.zip dist/Ollama-${OS}-${ARCH}.zip -cp ./ollama dist/ollama-${OS}-${ARCH} - # Create a new release. gh release create -p v$VERSION -t v$VERSION # Upload the zip file. -gh release upload v$VERSION ./dist/Ollama-${OS}-${ARCH}.zip --clobber - -# Upload the binary. -gh release upload v$VERSION ./dist/ollama-${OS}-${ARCH} --clobber - +gh release upload v$VERSION ./dist/* --clobber