From 47ea55b667c475e5136a7443a294159dde8f9428 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 22:35:24 +0100 Subject: [PATCH] test --- resources/version.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index 12928ad5..a9c494b8 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,31 +1,26 @@ #!/bin/bash STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) -SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) -COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") +COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count) CURRENT_VERSION=$(node -p -e "require('./package.json').version") -echo "Commits since stable: $COMMITSINCESTABLE" - # Make the version number if [[ $CIRCLE_BRANCH == "stable" || $GITHUB_REF_NAME == "stable" ]]; then - echo "This is a stable branch. Setting stable version." NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} -elif [[ $COMMITSINCESTABLE -gt 0 ]]; then +elif [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then echo "This is not a stable branch, but there are commits since the last stable release. Setting beta version." NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" fi -echo "Version: $NEW_VERSION" -echo "Current version: $CURRENT_VERSION" if [[ $COMMITSINCESTABLE -gt 0 ]]; then if [[ $RUNNER_OS == "macOS" ]]; then sed -i "" -e "s/$CURRENT_VERSION/$NEW_VERSION/" package.json else sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json fi + echo "Version updated to v${NEW_VERSION}" else - echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" + echo "Version unchanged, commits since stable is v${COMMITSINCESTABLE}" fi if [[ $GITHUB_REF_NAME != "" ]]; then @@ -33,6 +28,3 @@ if [[ $GITHUB_REF_NAME != "" ]]; then else echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV fi - -node -p -e "require('./package.json').version" -printenv \ No newline at end of file