From b8f661840aceab179341ea27208681609e437c0e Mon Sep 17 00:00:00 2001 From: Core Date: Mon, 3 Oct 2022 11:34:00 +0100 Subject: [PATCH] Environment variable for release version run --- .circleci/config.yml | 4 ++-- resources/version.sh | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 60d1e797..63d37b3d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,7 +29,7 @@ jobs: # name: Clear cache (only if CI fails uncomment this) # command: | # rm -rf ~/.pnpm-store || true - # rm -rf node_modules || true + # rm -rf node_modules || true - run: name: Clear node_airtunes2 cache command: rm -rf ~/.pnpm-store/tmp/_tmp_1469292_a6751613e03842bf2a6fa9a4b21c3e28 || true @@ -133,7 +133,7 @@ jobs: - run: name: Run Version Script command: | - sudo chmod +x resources/version.sh && ./resources/version.sh || true + sudo chmod +x resources/version.sh && GH_RELEASE_REQUEST=true ./resources/version.sh || true echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV - run: name: Publish Release diff --git a/resources/version.sh b/resources/version.sh index 4bb1c85a..b10b1c6f 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -11,7 +11,11 @@ fi SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) -COMMIT_SINCE_STABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") +if [[ $GH_RELEASE_REQUEST != "" ]]; then + COMMIT_SINCE_STABLE=$(printf "%03d\n" $(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE")) +else + COMMIT_SINCE_STABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") +fi CURRENT_VERSION=$(node -p -e "require('./package.json').version") # Set the version number for commits on main branch