[docs][ci] skip usage doc build for non-deploys (#31063)

* build: skip cli usage doc build for non-deploys

* fix: checking for CI

* chore: removed trailing whitespace

* fix: apease buildkite
This commit is contained in:
Nick Frostbutter 2023-04-13 14:26:26 -04:00 committed by GitHub
parent 1f67591e21
commit 768405c410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 4 deletions

View File

@ -3,6 +3,29 @@ set -e
cd "$(dirname "$0")"
# shellcheck source=ci/env.sh
source ../ci/env.sh
# Get current channel
eval "$(../ci/channel-info.sh)"
# set the output file' location
out=${1:-src/cli/usage.md}
# load the usage file's header
cat src/cli/.usage.md.header > "$out"
# Skip generating the usage doc for non deployment commits of the docs
if [[ -n $CI ]]; then
if [[ $CI_BRANCH != $EDGE_CHANNEL* ]] && [[ $CI_BRANCH != $BETA_CHANNEL* ]] && [[ $CI_BRANCH != $STABLE_CHANNEL* ]]; then
echo "**NOTE:** The usage doc is only auto-generated during full production deployments of the docs"
echo "**NOTE:** This usage doc is auto-generated during deployments" >> "$out"
exit
fi
fi
echo 'Building the solana cli from source...'
# shellcheck source=ci/rust-version.sh
source ../ci/rust-version.sh stable
@ -13,10 +36,6 @@ cargo build -p solana-cli
usage=$(cargo -q run -p solana-cli -- -C ~/.foo --help | sed -e 's|'"$HOME"'|~|g' -e 's/[[:space:]]\+$//')
out=${1:-src/cli/usage.md}
cat src/cli/.usage.md.header > "$out"
section() {
declare mark=${2:-"###"}
declare section=$1