Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release script #102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 18 additions & 23 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash -e

OTP_RAW_VER=$(erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell)
OTP_VER=$(echo "${OTP_RAW_VER}" | sed -r 's/\"([0-9]+)\"/\1/g' | sed 's/[^0-9]*//g')
EXPECTED_OTP=("24" "25" "26" "27")
EXPECTED_OTP=("25" "26" "27")

yes_or_exit() {
while true; do
Expand All @@ -15,11 +13,6 @@ yes_or_exit() {
done
}

if [ "${OTP_VER}" -lt "24" ]; then
echo "You are using Erlang/OTP ${OTP_VER}."
echo "However, ex_doc must be built using OTP >= 24 for compatibility. Giving up..."
exit
fi

VERSION=$1

Expand Down Expand Up @@ -48,22 +41,24 @@ fi
git checkout "v${VERSION}"

EX_DOC_VER="v$(grep -m1 "@ex_doc_version" mix.exs | awk '{print $2}' | tr -d '"')"
echo "Fetching ex_doc ${EX_DOC_VER} escript from GitHub ..."
curl -L -o ex_doc_otp_${OTP_VER} "https://github.com/elixir-lang/ex_doc/releases/download/${EX_DOC_VER}/ex_doc_otp_${OTP_VER}"
curl -L -o ex-doc-otp-${OTP_VER}.sha256sum "https://github.com/elixir-lang/ex_doc/releases/download/${EX_DOC_VER}/ex-doc-otp-${OTP_VER}.sha256sum"

echo "Validating integrity of ex_doc download..."

sha256sum -c ex-doc-otp-${OTP_VER}.sha256sum
for OTP_VER in "${EXPECTED_OTP[@]}"
do
echo "Fetching ex_doc ${EX_DOC_VER} escript from GitHub for OTP ${OTP_VER} ..."
curl -L -o ex_doc_otp_${OTP_VER} "https://github.com/elixir-lang/ex_doc/releases/download/${EX_DOC_VER}/ex_doc_otp_${OTP_VER}"
curl -L -o ex-doc-otp-${OTP_VER}.sha256sum "https://github.com/elixir-lang/ex_doc/releases/download/${EX_DOC_VER}/ex-doc-otp-${OTP_VER}.sha256sum"

chmod +x ex_doc_otp_${OTP_VER}
mv ex_doc_otp_${OTP_VER} priv
mv ex-doc-otp-${OTP_VER}.sha256sum priv
echo "Validating integrity of ex_doc download..."

echo "Looks good!"
sha256sum -c ex-doc-otp-${OTP_VER}.sha256sum

SIZE=$(du -ah priv/ex_doc_otp_${OTP_VER} | awk '{print $1}')
echo "Size of priv/ex_doc_otp_${OTP_VER}: $SIZE"
chmod +x ex_doc_otp_${OTP_VER}
mv ex_doc_otp_${OTP_VER} priv
mv ex-doc-otp-${OTP_VER}.sha256sum priv
echo "Looks good!"
SIZE=$(du -ah priv/ex_doc_otp_${OTP_VER} | awk '{print $1}')
echo "Size of priv/ex_doc_otp_${OTP_VER}: $SIZE"
done

rebar3 ex_doc

Expand All @@ -79,10 +74,10 @@ open doc/index.html
echo
yes_or_exit "Did everything look ok?"

for OTP in "${EXPECTED_OTP[@]}"
for OTP_VER in "${EXPECTED_OTP[@]}"
do
if [ ! -f "priv/ex_doc_otp_${OTP}" ]; then
echo "Expected file 'priv/ex_doc_otp_${OTP}' does not exist."
if [ ! -f "priv/ex_doc_otp_${OTP_VER}" ]; then
echo "Expected file 'priv/ex_doc_otp_${OTP_VER}' does not exist."
exit 1
fi
done
Expand Down
Loading