-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-latests.sh
36 lines (29 loc) · 1.12 KB
/
build-latests.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
#!/bin/sh
set -eu
# Without arguments builds all, with implementation name as argument builds just that one
build_only="${1:-}"
cd "$(dirname "$0")"
implementations=$(find ./implementations -maxdepth 1 -name "*")
for path in $implementations; do
name=$(basename "${path}")
latest_path=$(find "${path}/" -maxdepth 1 -name "*" -not -name "head" | sort | tail -n 1)
latest_version=$(basename "$latest_path")
case ${latest_version} in
'' | *[!0-9]*)
if [ "${build_only}" = "" ] || [ "${build_only}" = "${name}" ]; then
echo "Latest of ${name} is ${latest_version} which is not valid and won't be built"
fi
;;
*)
if [ "${build_only}" = "" ] || [ "${build_only}" = "${name}" ]; then
echo "Latest of ${name} is ${latest_version}"
echo "Building path ${latest_path}"
docker build "${latest_path}" --tag="schemers/${name}:latest"
docker build "${latest_path}" --tag="schemers/${name}:${latest_version}"
if [ ! "${build_only}" = "${name}" ]; then
exit
fi
fi
;;
esac
done