-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·34 lines (26 loc) · 1.08 KB
/
build.sh
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
# Create output directory
mkdir -p output
# Get latest tags
git pull
# Get version number from tag name
export VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
if [ -n "$VERSION" ]; then
# Confirm version number with user before build
read -p "Build with version $VERSION? C-c to cancel, any key to continue " -n 1 -r
echo
# Update version number in Cargo.toml for build
# macOS sed requires the weird empty string param
# Otherwise it returns `invalid command code C`
sed -i '' "s/version = \"0.0.0\"/version = \"$VERSION\"/g" Cargo.toml
# Build for Apple Silicon
cargo build --target aarch64-apple-darwin --release
cp target/aarch64-apple-darwin/release/logria output/logria-aarch64-apple-darwin
# Build for 64-bit Intel macOS
cargo build --target x86_64-apple-darwin --release
cp target/x86_64-apple-darwin/release/logria output/logria-x86_64-apple-darwin
# Put the version number back
sed -i '' "s/version = \"$VERSION\"/version = \"0.0.0\"/g" Cargo.toml
unset VERSION
else
echo 'No version tag set!'
fi