Updated version.sh
This commit is contained in:
parent
4b299b032b
commit
838ce7efcb
1 changed files with 5 additions and 3 deletions
|
@ -1,17 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
printenv
|
||||
|
||||
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")
|
||||
CURRENT_VERSION=$(node -p -e "require('./package.json').version")
|
||||
if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then
|
||||
if [[ ($CIRCLE_BRANCH != "stable" && $GITHUB_REF_NAME != "stable") && $COMMITSINCESTABLE -gt 0 ]]; then
|
||||
NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}"
|
||||
else
|
||||
NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE}
|
||||
fi
|
||||
echo "Version: $NEW_VERSION"
|
||||
|
||||
if [[ $COMMITSINCESTABLE -gt 0 ]]; then
|
||||
echo "Version: $NEW_VERSION"
|
||||
sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json
|
||||
else
|
||||
echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue