sourcegraph/dev/docsite.sh

31 lines
690 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
set -euf -o pipefail
pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null
2022-01-25 07:20:00 +00:00
# Update DOCSITE_VERSION everywhere in all places (including outside this repo)
2023-08-18 18:40:44 +00:00
version=v1.9.4
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}" "$@"