Skip to content

Commit

Permalink
using branch approach to calculate version when not directly tagged.
Browse files Browse the repository at this point in the history
Then, it will be something like this:
- tagged versions will be called: Pharo7.0.0-rc2* (for example)
- non tagger versions will be called: Pharo7.0-SNAPSHOT* (for example)
  • Loading branch information
estebanlm committed Nov 22, 2018
1 parent dc57c95 commit b9801e3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions bootstrap/scripts/4-build.sh
Expand Up @@ -8,6 +8,12 @@ set -e
SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P)"
. ${SCRIPTS}/envvars.sh

if [ $(is_version) == 1 ]; then
PHARO_NAME_PREFIX=${PHARO_VERSION_PREFIX}
else
PHARO_NAME_PREFIX=${PHARO_SNAPSHOT_PREFIX}
fi

# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.

Expand Down
20 changes: 17 additions & 3 deletions bootstrap/scripts/envversion.sh
Expand Up @@ -5,8 +5,22 @@
# - current image version prefix, e.g. "Pharo7.0.0-rc1"
# - vm version for the current image, to be used to download the correct vm, e.g. "70"

# Versions are taken from tags. Tag should have a format like vMAJOR.MINOR.PATCH[-EXTRA], e.g. v7.0.0-rc1
PHARO_VERSION_PREFIX="Pharo`git describe --long --tags | cut -d'-' -f 1-2 | cut -c 2-`"
# Snapshots are taken from branchs. Branchs should be named dev-MAJOR.MINOR (example: dev-7.0)
PHARO_SNAPSHOT_PREFIX="Pharo`git branch | grep \* | cut -d' ' -f 2 | cut -d'-' -f 2`-SNAPSHOT"

PHARO_NAME_PREFIX="Pharo`git describe --long --tags | cut -d'-' -f 1-2 | cut -c 2-`"
PHARO_SHORT_VERSION=`git describe --long --tags | cut -d'-' -f 1 | cut -c 2- | cut -d'.' -f 1-2 | sed 's/\.//'`
PHARO_SHORT_VERSION=`git branch | grep \* | cut -d' ' -f 2 | cut -d'-' -f 2 | sed 's/\.//'`
# this is just to make things clear (and because they could change in the future, who knows :P)
PHARO_VM_VERSION="${PHARO_SHORT_VERSION}"
PHARO_VM_VERSION="${PHARO_SHORT_VERSION}"

# use this to know if we are in a version or a SNAPSHOT
function is_version() {
set -f
local versionTag=$(git tag --list --points-at HEAD | grep -E "^v[0-9]+\.[0-9]+.[0-9]+(\-[a-zA-Z0-9_]+)?$")
if [ "${versionTag}" == "" ]; then
echo 0
else
echo 1
fi
}

0 comments on commit b9801e3

Please sign in to comment.