diff --git a/ci/check-channel-version.sh b/ci/check-channel-version.sh new file mode 100755 index 000000000..abd9d1063 --- /dev/null +++ b/ci/check-channel-version.sh @@ -0,0 +1,27 @@ + # Ensure the current channel version is not equal ("greater") than +# the version of the latest tag +if [[ -z $CI_TAG ]]; then + echo "--- channel version check" + ( + eval "$(ci/channel-info.sh)" + + if [[ -n $CHANNEL_LATEST_TAG ]]; then + source scripts/read-cargo-variable.sh + + version=$(readCargoVariable version "version/Cargo.toml") + echo "latest channel tag: $CHANNEL_LATEST_TAG" + echo "current version: v$version" + + if [[ $CHANNEL_LATEST_TAG = v$version ]]; then + echo -e "\033[31mError:\033[0m A release has been tagged since your feature branch was last rebased. must be greater than .. + Possible solutions (in the order they should be tried): + 1. rebase your feature branch on the base branch + 2. merge the PR: \"Bump Version to ...\" once it has passed ci/checks, then rebase + 3. ask for help in #devops on discord" + exit 1 + fi + else + echo "Skipped. CHANNEL_LATEST_TAG (CHANNEL=$CHANNEL) unset" + fi + ) +fi diff --git a/ci/test-sanity.sh b/ci/test-sanity.sh index c4dd244bb..7d482982e 100755 --- a/ci/test-sanity.sh +++ b/ci/test-sanity.sh @@ -22,32 +22,8 @@ source ci/_ echo +_ ci/check-channel-version.sh _ ci/nits.sh _ ci/check-ssh-keys.sh - -# Ensure the current channel version is not equal ("greater") than -# the version of the latest tag -if [[ -z $CI_TAG ]]; then - echo "--- channel version check" - ( - eval "$(ci/channel-info.sh)" - - if [[ -n $CHANNEL_LATEST_TAG ]]; then - source scripts/read-cargo-variable.sh - - version=$(readCargoVariable version "version/Cargo.toml") - echo "version: v$version" - echo "latest channel tag: $CHANNEL_LATEST_TAG" - - if [[ $CHANNEL_LATEST_TAG = v$version ]]; then - echo "Error: please run ./scripts/increment-cargo-version.sh" - exit 1 - fi - else - echo "Skipped. CHANNEL_LATEST_TAG (CHANNEL=$CHANNEL) unset" - fi - ) -fi - echo --- ok