2020-03-12 08:36:19 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-03-12 14:34:28 -07:00
|
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
2020-03-12 08:36:19 -07:00
|
|
|
if [[ -n $CI_TAG ]]; then
|
|
|
|
LATEST_SOLANA_RELEASE_VERSION=$CI_TAG
|
2020-06-18 16:41:14 -07:00
|
|
|
elif [[ -z $CI_PULL_REQUEST ]]; then
|
2020-03-12 08:36:19 -07:00
|
|
|
LATEST_SOLANA_RELEASE_VERSION=$(\
|
|
|
|
curl -sSfL https://api.github.com/repos/solana-labs/solana/releases/latest \
|
|
|
|
| grep -m 1 tag_name \
|
|
|
|
| sed -ne 's/^ *"tag_name": "\([^"]*\)",$/\1/p' \
|
|
|
|
)
|
2020-06-18 16:41:14 -07:00
|
|
|
else
|
|
|
|
# Don't bother the `api.github.com` on pull requests to avoid getting rate
|
|
|
|
# limited
|
|
|
|
LATEST_SOLANA_RELEASE_VERSION=unknown-version
|
2020-03-12 08:36:19 -07:00
|
|
|
fi
|
|
|
|
|
2020-06-03 11:08:32 -07:00
|
|
|
if [[ -z "$LATEST_SOLANA_RELEASE_VERSION" ]]; then
|
|
|
|
echo Error: release version not defined
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-03-12 08:36:19 -07:00
|
|
|
set -x
|
2020-04-03 10:21:34 -07:00
|
|
|
find html/ -name \*.html -exec sed -i "s/LATEST_SOLANA_RELEASE_VERSION/$LATEST_SOLANA_RELEASE_VERSION/g" {} \;
|
2020-03-12 14:34:28 -07:00
|
|
|
if [[ -n $CI ]]; then
|
2020-04-03 10:21:34 -07:00
|
|
|
find src/ -name \*.md -exec sed -i "s/LATEST_SOLANA_RELEASE_VERSION/$LATEST_SOLANA_RELEASE_VERSION/g" {} \;
|
2020-03-12 14:34:28 -07:00
|
|
|
fi
|