Skip to content

Commit

Permalink
Improve build to archive binary and resources
Browse files Browse the repository at this point in the history
  • Loading branch information
dvkch committed Feb 22, 2023
1 parent 8d40f48 commit 5f8ab05
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ set -e

if [ "x$1" = "xrelease" ]; then
# cleanup
rm -rf .build
rm -rf .build/ build/

# build for macOS
swift build --arch arm64 --arch x86_64 -c release
mkdir -p "build/macOS"
rsync -ar ".build/apple/Products/Release/harbor" "build/macOS"
rsync -ar ".build/apple/Products/Release/Harbor_Harbor.bundle" "build/macOS"
tar -C build/macOS -czvf build/macOS.tar.gz .

# build for linux
if ! command -v docker &> /dev/null; then
Expand All @@ -23,12 +24,14 @@ if [ "x$1" = "xrelease" ]; then
mkdir -p "build/linux-amd64"
rsync -ar ".build/x86_64-unknown-linux-gnu/release/harbor" "build/linux-amd64"
rsync -ar ".build/x86_64-unknown-linux-gnu/release/Harbor_Harbor.resources" "build/linux-amd64"
tar -C build/linux-amd64 -czvf build/linux-amd64.tar.gz .

docker container rm -f harbor-linux > /dev/null
docker run -it --name harbor-linux --platform linux/arm64/v8 -v $(pwd):/harbor swift:latest /bin/bash -c "cd harbor && swift build -c release"
mkdir -p "build/linux-arm64"
rsync -ar ".build/aarch64-unknown-linux-gnu/release/harbor" "build/linux-arm64"
rsync -ar ".build/aarch64-unknown-linux-gnu/release/Harbor_Harbor.resources" "build/linux-arm64"
tar -C build/linux-arm64 -czvf build/linux-arm64.tar.gz .

else
swift build --arch arm64 --arch x86_64 -c debug
Expand Down

0 comments on commit 5f8ab05

Please sign in to comment.