moved check
This commit is contained in:
parent
4b2bd5f52f
commit
6d9bb8fa95
1 changed files with 13 additions and 17 deletions
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
# Setup the variables needed
|
# Setup the variables needed
|
||||||
if [[ $GH_REQUEST_TOKEN != "" ]]; then
|
if [[ $GH_REQUEST_TOKEN != "" ]]; then
|
||||||
STABLE_SHA=$(curl -H "Authorization: token ${GH_REQUEST_TOKEN}" -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4)
|
STABLE_SHA=$(curl -H "Authorization: token ${GH_REQUEST_TOKEN}" -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4)
|
||||||
elif [[ $GITHUB_TOKEN != "" ]]; then
|
elif [[ $GITHUB_TOKEN != "" ]]; then
|
||||||
STABLE_SHA=$(curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4)
|
STABLE_SHA=$(curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4)
|
||||||
else
|
else
|
||||||
STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4)
|
STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SHA_DATE=$(git show -s --format=%ci $STABLE_SHA)
|
SHA_DATE=$(git show -s --format=%ci $STABLE_SHA)
|
||||||
|
@ -14,19 +14,15 @@ COMMIT_SINCE_STABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE"
|
||||||
CURRENT_VERSION=$(node -p -e "require('./package.json').version")
|
CURRENT_VERSION=$(node -p -e "require('./package.json').version")
|
||||||
|
|
||||||
# Set the version number for commits on main branch
|
# Set the version number for commits on main branch
|
||||||
if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMIT_SINCE_STABLE -gt 0 ]]; then
|
if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMIT_SINCE_STABLE -gt 0 && $(node -p -e "require('./package.json').version" | cut -d '.' -f 4) != $COMMIT_SINCE_STABLE ]]; then
|
||||||
NEW_VERSION="${CURRENT_VERSION}-beta.${COMMIT_SINCE_STABLE}"
|
NEW_VERSION="${CURRENT_VERSION}-beta.${COMMIT_SINCE_STABLE}"
|
||||||
|
# Update the version in package.json
|
||||||
# Not sure why this is needed, but it is
|
if [[ $RUNNER_OS == "macOS" ]]; then
|
||||||
if [[ $() != $COMMIT_SINCE_STABLE ]]; then
|
sed -i "" -e "s/$CURRENT_VERSION/$NEW_VERSION/" package.json
|
||||||
# Update the version in package.json
|
else
|
||||||
if [[ $RUNNER_OS == "macOS" ]]; then
|
sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json
|
||||||
sed -i "" -e "s/$CURRENT_VERSION/$NEW_VERSION/" package.json
|
fi
|
||||||
else
|
echo $NEW_VERSION
|
||||||
sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json
|
|
||||||
fi
|
|
||||||
echo $NEW_VERSION
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo $CURRENT_VERSION
|
echo $CURRENT_VERSION
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue