From d13694d83988a6d498f99bb1364debac7622f67e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 30 Sep 2020 18:23:49 +0000 Subject: [PATCH] Tighten docs publishing flow (#12572) (#12594) (cherry picked from commit ede19ef33be550f975b497f6d9b3a2d7478ab1c0) Co-authored-by: Dan Albert --- .travis.yml | 1 + .travis/channel_restriction.sh | 17 +++++++++++++++++ docs/set-solana-release-tag.sh | 20 ++------------------ 3 files changed, 20 insertions(+), 18 deletions(-) create mode 100755 .travis/channel_restriction.sh diff --git a/.travis.yml b/.travis.yml index f263238a9f..b1bffacf59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -124,6 +124,7 @@ jobs: - ~/.npm before_install: + - .travis/channel_restriction.sh edge beta || travis_terminate 0 - .travis/affects.sh docs/ .travis || travis_terminate 0 - cd docs/ - source .travis/before_install.sh diff --git a/.travis/channel_restriction.sh b/.travis/channel_restriction.sh new file mode 100755 index 0000000000..637bfc9ed3 --- /dev/null +++ b/.travis/channel_restriction.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Only proceed if we are on one of the channels passed in when calling this file +# + +set -ex + +eval "$(ci/channel-info.sh)" + +for acceptable_channel in "$@"; do + if [[ "$CHANNEL" == "$acceptable_channel" ]]; then + exit 0 + fi +done + +echo "Not running from one of the following channels: $*" +exit 1 diff --git a/docs/set-solana-release-tag.sh b/docs/set-solana-release-tag.sh index 58b6e04c0e..68bab795c1 100755 --- a/docs/set-solana-release-tag.sh +++ b/docs/set-solana-release-tag.sh @@ -3,25 +3,9 @@ set -e cd "$(dirname "$0")" -if [[ -n $CI_TAG ]]; then - LATEST_SOLANA_RELEASE_VERSION=$CI_TAG -elif [[ -z $CI_PULL_REQUEST ]]; then - 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' \ - ) -else - # Don't bother the `api.github.com` on pull requests to avoid getting rate - # limited - LATEST_SOLANA_RELEASE_VERSION=unknown-version -fi - -if [[ -z "$LATEST_SOLANA_RELEASE_VERSION" ]]; then - echo Error: release version not defined - exit 1 -fi +eval "$(../ci/channel-info.sh)" +LATEST_SOLANA_RELEASE_VERSION=$BETA_CHANNEL_LATEST_TAG VERSION_FOR_DOCS_RS="${LATEST_SOLANA_RELEASE_VERSION:1}" set -x