Skip to content

Commit

Permalink
bump to v0.18.0.0 and simplify local build script
Browse files Browse the repository at this point in the history
  • Loading branch information
cornfeedhobo committed Aug 1, 2022
1 parent 989f29d commit ab4647b
Showing 1 changed file with 19 additions and 36 deletions.
55 changes: 19 additions & 36 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,31 @@ if [ -n "${DEBUG:-}" ]; then
fi

repo='monero-project/monero'
branch="$(git rev-parse --abbrev-ref HEAD)"
tag="$(git rev-parse --abbrev-ref HEAD)"
sha="$(curl -LSs "https://api.github.com/repos/${repo}/git/ref/tags/${tag}" | jq -r '.object.sha')"

tag="${branch}"
declare -a tags=( "${tag}" )
if [ "${branch}" = 'master' ]; then
tag="$(curl -LSs "https://api.github.com/repos/${repo}/releases/latest" | jq -r '.tag_name')"
tags=( "${tag}" 'latest')
fi

read -r tag_type tag_sha < <(curl -LSs "https://api.github.com/repos/${repo}/git/ref/tags/${tag}" | jq -r '.object.type,.object.sha')
if [ ! "${tag_type}" = 'commit' ]; then
tag_sha="$(curl -LSs "https://api.github.com/repos/${repo}/git/tags/${tag_sha}" | jq -r '.object.sha')"
fi

build_date="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
build_flags="${1:-}"
build_date="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
build_script="$(sed -e "s/[[:space:]]\+/ /g" <<-ENDSCRIPT
docker build ${build_flags} \
--build-arg "BUILD_DATE=${build_date}" \
--build-arg "MONERO_VERSION=${tag}" \
--build-arg "MONERO_HASH=${sha}" \
--build-arg "MONERO_TARGET=release" \
-t cornfeedhobo/monero:${tag} .
ENDSCRIPT
)"

echo -e "
$(sed -e "s/[[:space:]]\+--/\n --/g" -e "s/[[:space:]]-t/\n -t/" <<<"${build_script}")
Are you ready to proceed?
"

build_script=''
for t in "${tags[@]}"; do
for s in '' '-static'; do
build_script+="$(cat <<-ENDSCRIPT
docker build ${build_flags} \
--build-arg "BUILD_DATE=${build_date}" \
--build-arg "MONERO_VERSION=${tag}" \
--build-arg "MONERO_HASH=${tag_sha}" \
--build-arg "MONERO_TARGET=release${s}" \
-t cornfeedhobo/monero:${t}${s} .
ENDSCRIPT
)"
build_script+=$'\n'
done
done
build_script="$(sed -e "s/[[:space:]]\+/ /g" <<< "${build_script}")"

echo -e "${build_script}\n"

echo 'Are you ready to proceed?'
select confirm in 'Yes' 'No'; do
case $confirm in
Yes)
eval "${build_script}"
exit
exec ${build_script}
;;
*)
exit
Expand Down

0 comments on commit ab4647b

Please sign in to comment.