Skip to content

Commit

Permalink
Merge 61e844d into b274dee
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcooperxyz authored Jan 19, 2022
2 parents b274dee + 61e844d commit 18ddc64
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions scripts/check-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ function get_working_copy_version() {
assert_tomlq
CURRENT_VERSION=$(tomlq .package.version ./node/Cargo.toml | sed 's/"//g')

printf "This version found to be %s\n" "$CURRENT_VERSION"

branch_name="$(git symbolic-ref HEAD 2>/dev/null)" ||
branch_name="(unnamed branch)" # detached HEAD (or possibly github workflow?)
branch_name=${branch_name##refs/heads/}
Expand All @@ -68,7 +70,7 @@ function get_working_copy_version() {
SANE_BRANCH_NAME_KEY=$(echo $branch_name | sed -e 's#/#_#g')
CURRENT_VERSION=$(echo $CURRENT_VERSION | sed -e 's#/#_#g')

printf "Current %s found to be %s\n" "$release_type" "$CURRENT_VERSION"
printf "This %s found to be %s\n" "$release_type" "$CURRENT_VERSION"
}

# Get published git tags that match semver regex with a "v" prefixbash then remove the "v" character
Expand All @@ -77,16 +79,18 @@ PUBLISHED_VERSIONS=$(git tag | grep "^v[0-9]\+\.[0-9]\+\.[0-9]\+\(\-[a-zA-Z-]\+\

get_working_copy_version

if check_version_greater "$CURRENT_VERSION" "$PUBLISHED_VERSIONS" || $IS_PRERELEASE; then
echo "##[set-output name=VERSION;]v$CURRENT_VERSION"
echo "##[set-output name=SANE_BRANCH_NAME_KEY;]$SANE_BRANCH_NAME_KEY"
echo "##[set-output name=BUILD_DATE;]$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
echo "##[set-output name=VERSION;]v$CURRENT_VERSION"
echo "##[set-output name=SANE_BRANCH_NAME_KEY;]$SANE_BRANCH_NAME_KEY"
echo "##[set-output name=BUILD_DATE;]$(date -u +'%Y-%m-%dT%H:%M:%SZ')"

if check_version_greater "$CURRENT_VERSION" "$PUBLISHED_VERSIONS"; then
echo "##[set-output name=IS_NEW_VERSION;]true"
if [ $IS_PRERELEASE ]; then
echo "##[set-output name=IS_PRERELEASE;]true"
else
echo "##[set-output name=IS_PRERELEASE;]false"
fi
else
echo "##[set-output name=IS_NEW_VERSION;]false"
fi

if [ $IS_PRERELEASE ]; then
echo "##[set-output name=IS_PRERELEASE;]true"
else
echo "##[set-output name=IS_PRERELEASE;]false"
fi

0 comments on commit 18ddc64

Please sign in to comment.