sourcegraph/dev/docsite.sh
2022-05-30 13:47:04 +00:00

31 lines
690 B
Bash
Executable File

#!/usr/bin/env bash
set -euf -o pipefail
pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null
# Update DOCSITE_VERSION everywhere in all places (including outside this repo)
version=v1.8.7
suffix="${version}_$(go env GOOS)_$(go env GOARCH)"
url="https://github.com/sourcegraph/docsite/releases/download/${version}/docsite_${suffix}"
base="$PWD/.bin"
if [[ "${CI:-"false"}" == "true" ]]; then
base="/tmp"
fi
target="${base}/docsite_${suffix}"
mkdir -p "$(dirname "${target}")"
if [ ! -f "${target}" ]; then
echo "downloading ${url}" 1>&2
curl -sS -L -f "${url}" -o "${target}.tmp"
mv "${target}.tmp" "${target}"
fi
chmod +x "${target}"
popd >/dev/null
exec "${target}" "$@"