From e1d731f8ce644803abe3aa4dd430feff3a34f425 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 22:44:51 +0100 Subject: [PATCH] test 2 --- resources/version.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index a9c494b8..aca03be7 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -4,15 +4,11 @@ STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count) CURRENT_VERSION=$(node -p -e "require('./package.json').version") -# Make the version number -if [[ $CIRCLE_BRANCH == "stable" || $GITHUB_REF_NAME == "stable" ]]; then - NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} -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." +# Set the version number for commits on main branch +if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "enhancement/ci") && $COMMITSINCESTABLE -gt 0 ]]; then NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" -fi -if [[ $COMMITSINCESTABLE -gt 0 ]]; then + # Update the version in package.json if [[ $RUNNER_OS == "macOS" ]]; then sed -i "" -e "s/$CURRENT_VERSION/$NEW_VERSION/" package.json else @@ -20,9 +16,10 @@ if [[ $COMMITSINCESTABLE -gt 0 ]]; then fi echo "Version updated to v${NEW_VERSION}" else - echo "Version unchanged, commits since stable is v${COMMITSINCESTABLE}" + echo "Not on main branch or no commits since stable. Skipping version update." fi +# Add the version to the environment for CI usage if [[ $GITHUB_REF_NAME != "" ]]; then echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV else