-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): include version/cli checks in tagged releases
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# Validate lotus version matches the current tag | ||
# $1 - lotus path to execute | ||
# $2 - lotus git tag for this release | ||
function validate_lotus_version_matches_tag(){ | ||
# sanity checks | ||
if [[ $# != 2 ]]; then | ||
echo "expected 2 args for validate_lotus_version, got ${$#}" | ||
exit 100 | ||
fi | ||
|
||
# extract version from `lotus --version` response | ||
lotus_path=$1 | ||
# get version | ||
lotus_raw_version=`${lotus_path} --version` | ||
# trim leading unwanted text ('lotus version ' literal) | ||
lotus_headtrimmed_version=${lotus_raw_version#lotus version } | ||
# trim tailing unwanted text (everything after 1st '+') | ||
lotus_actual_version=${lotus_headtrimmed_version%%+*} | ||
|
||
# trim leading 'v' | ||
tag=${2#v} | ||
# trim possible -rc[0-9] | ||
expected_version=${tag%-*} | ||
|
||
# check the versions are consistent | ||
if [[ ${expected_version} != ${lotus_actual_version} ]]; then | ||
echo "lotus version does not match build tag" | ||
exit 101 | ||
fi | ||
} | ||
|
||
_lotus_path=$1 | ||
|
||
if [[ ! -z "${CIRCLE_TAG}" ]]; then | ||
validate_lotus_version_matches_tag "${_lotus_path}" "${CIRCLE_TAG}" | ||
else | ||
echo "No CI tag found. Skipping version check." | ||
fi |