2018-03-05 07:36:24 -06:00
|
|
|
#!/bin/bash
|
|
|
|
# Builds all Docker images this project provides
|
2018-04-10 03:37:27 -05:00
|
|
|
# Arguments:
|
|
|
|
# BUILD: The release to build.
|
|
|
|
# Allowed: release, prerelease, branches, special
|
|
|
|
# Default: undefined
|
|
|
|
|
2018-04-10 03:58:31 -05:00
|
|
|
echo "▶️ $0 $*"
|
|
|
|
|
2018-04-10 03:37:27 -05:00
|
|
|
ALL_BUILDS=("release" "prerelease" "branches" "special")
|
|
|
|
BUILDS=("${BUILD:-"${ALL_BUILDS[@]}"}")
|
|
|
|
|
|
|
|
echo "⚙️ Configured builds: ${BUILDS[*]}"
|
2018-03-05 07:36:24 -06:00
|
|
|
|
2019-02-01 02:58:07 -06:00
|
|
|
if [ -n "${DEBUG}" ]; then
|
2018-03-05 07:36:24 -06:00
|
|
|
export DEBUG
|
|
|
|
fi
|
|
|
|
|
|
|
|
ERROR=0
|
|
|
|
|
|
|
|
# Don't build if not on `master` and don't build if on a pull request,
|
|
|
|
# but build when DEBUG is not empty
|
|
|
|
|
2019-10-10 05:42:10 -05:00
|
|
|
for BUILD in "${BUILDS[@]}"; do
|
|
|
|
echo "🛠 Building '$BUILD' from '$DOCKERFILE'"
|
|
|
|
case $BUILD in
|
|
|
|
release)
|
|
|
|
# build the latest release
|
|
|
|
# shellcheck disable=SC2068
|
|
|
|
./build-latest.sh $@ || ERROR=1
|
|
|
|
;;
|
|
|
|
prerelease)
|
|
|
|
# build the latest pre-release
|
|
|
|
# shellcheck disable=SC2068
|
|
|
|
PRERELEASE=true ./build-latest.sh $@ || ERROR=1
|
|
|
|
;;
|
|
|
|
branches)
|
|
|
|
# build all branches
|
|
|
|
# shellcheck disable=SC2068
|
|
|
|
./build-branches.sh $@ || ERROR=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "🚨 Unrecognized build '$BUILD'."
|
2018-03-05 07:36:24 -06:00
|
|
|
|
2019-02-01 02:58:07 -06:00
|
|
|
if [ -z "$DEBUG" ]; then
|
2019-10-10 05:42:10 -05:00
|
|
|
exit 1
|
2019-02-01 02:58:07 -06:00
|
|
|
else
|
2019-10-10 05:42:10 -05:00
|
|
|
echo "⚠️ Would exit here with code '1', but DEBUG is enabled."
|
2018-03-05 07:36:24 -06:00
|
|
|
fi
|
2019-10-10 05:42:10 -05:00
|
|
|
;;
|
|
|
|
esac
|
2019-02-01 02:58:07 -06:00
|
|
|
done
|
2018-03-05 07:36:24 -06:00
|
|
|
|
|
|
|
exit $ERROR
|