Comments and echos
This commit is contained in:
parent
5a921b0be4
commit
dbef4daade
1 changed files with 6 additions and 2 deletions
|
@ -1,16 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
printenv
|
|
||||||
|
|
||||||
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)
|
||||||
SHA_DATE=$(git show -s --format=%ci $STABLE_SHA)
|
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 --since="$SHA_DATE")
|
||||||
CURRENT_VERSION=$(node -p -e "require('./package.json').version")
|
CURRENT_VERSION=$(node -p -e "require('./package.json').version")
|
||||||
|
|
||||||
|
# Make the version number
|
||||||
if [[ ($CIRCLE_BRANCH != "stable" && $GITHUB_REF_NAME != "stable") && $COMMITSINCESTABLE -gt 0 ]]; then
|
if [[ ($CIRCLE_BRANCH != "stable" && $GITHUB_REF_NAME != "stable") && $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}"
|
NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}"
|
||||||
else
|
else
|
||||||
|
echo "This is a stable branch. Setting stable version."
|
||||||
NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE}
|
NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Version: $NEW_VERSION"
|
echo "Version: $NEW_VERSION"
|
||||||
echo "Current version: $CURRENT_VERSION"
|
echo "Current version: $CURRENT_VERSION"
|
||||||
if [[ $COMMITSINCESTABLE -gt 0 ]]; then
|
if [[ $COMMITSINCESTABLE -gt 0 ]]; then
|
||||||
|
@ -19,6 +22,7 @@ else
|
||||||
echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}"
|
echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make it a environment variable
|
||||||
if [[ -z "${GITHUB_ENV}" ]]; then
|
if [[ -z "${GITHUB_ENV}" ]]; then
|
||||||
echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV
|
echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV
|
||||||
elif [[ -z "${BASH_ENV}" ]]; then
|
elif [[ -z "${BASH_ENV}" ]]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue