Skip to content

Commit

Permalink
Better detection of master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
marcvs committed Jan 18, 2024
1 parent 398813d commit e836dbc
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions .gitlab-ci-scripts/set-prerelease-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,33 @@ done
# Get master branch name:
# use origin if exists
# else use last found remote
REMOTES=$(git remote show)
for R in $REMOTES; do
MASTER=$(git remote show "$R" 2>/dev/null \
| sed -n '/HEAD branch/s/.*: //p')
MASTER_BRANCH="refs/remotes/${R}/${MASTER}"
#echo "Master-branch: ${MASTER_BRANCH}"
[ "x${R}" == "xorigin" ] && break
done
MASTER_BRANCH=""
get_master_branch_of_mteam() {
git remote -vv | awk -F[\\t@:] '{ print $1 " " $3 }' | while read REMOTE HOST; do
# echo " $HOST -- $REMOTE"
MASTER=$(git remote show "$REMOTE" 2>/dev/null \
| sed -n '/HEAD branch/s/.*: //p')
MASTER_BRANCH="refs/remotes/${REMOTE}/${MASTER}"
[ "x${HOST}" == "xcodebase.helmholtz.cloud" ] && {
echo "${MASTER_BRANCH}"
break
}
[ "x${HOST}" == "xgit.scc.kit.edu" ] && {
echo "${MASTER_BRANCH}"
break
}
[ "x${REMOTE}" == "xorigin" ] && {
echo "${MASTER_BRANCH}"
break
}
done
}

MASTER_BRANCH=$(get_master_branch_of_mteam)
PREREL=$(git rev-list --count HEAD ^"$MASTER_BRANCH")



# use version file:
VERSION=$(cat $VERSION_FILE)
PR_VERSION="${VERSION}-${DEVSTRING}${PREREL}"
Expand Down

0 comments on commit e836dbc

Please sign in to comment.