-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.sh
executable file
·47 lines (43 loc) · 1.24 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Parse arguments
for i in "$@"; do
case "$1" in
-d | --docker ) DOCKER=true ;;
-s | --schema ) SCHEMA=true ;;
-v | --version) VERSION="$2"; shift ;;
-u | --update) UPDATE=true ;;
-e | --embedded) EMBEDDED=true ;;
* ) break ;;
esac
shift
done
# Generate the JSON schema?
if [ $SCHEMA ]; then
if [ ! -z $VERSION ]; then
cargo run -- schema --output "./schemas/v$VERSION.json"
else
echo "You must specify a version using the --version option."
exit -1;
fi
fi
# Update versions?
if [ $UPDATE ]; then
if [ ! -z $VERSION ]; then
sed -i -e "/^version/ s/[[:digit:]][[:digit:]]*.[[:digit:]][[:digit:]]*.[[:digit:]][[:digit:]]*/$VERSION/" Cargo.toml
sed -i -e "/version/ s/[[:digit:]][[:digit:]]*.[[:digit:]][[:digit:]]*.[[:digit:]][[:digit:]]*/$VERSION/" web/package.json
else
echo "You must specify a version using the --version option."
exit -1;
fi
fi
# Build Docker image?
if [ $DOCKER ]; then
docker build -t "duckhq/duck:latest" \
-t "duckhq/duck:$VERSION" \
-t "spectresystems/duck:latest" \
-t "spectresystems/duck:$VERSION" \
--build-arg "VERSION=$VERSION" .
fi
# Embedded server?
if [ $EMBEDDED ]; then
cargo build --release --features embedded-web
fi