version.sh 1.12 KB
Newer Older
1
2
#!/bin/bash

eric pellegrini's avatar
eric pellegrini committed
3
cd ${CI_PROJECT_DIR}
4

5
# Update the __pkginfo__ file with the current commit
6
echo -e "${BLUE}""Commit id = ${MDANSE_GIT_CURRENT_COMMIT}<--""${NORMAL}"
7
echo -e "${BLUE}""Branch name = ${MDANSE_GIT_BRANCH_NAME}<--""${NORMAL}"
eric pellegrini's avatar
eric pellegrini committed
8
$SED_I_COMMAND "s/.*__commit__.*/__commit__ = \"${MDANSE_GIT_CURRENT_COMMIT}\"/" ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py
9
10

# Get MDANSE version
eric pellegrini's avatar
eric pellegrini committed
11
MDANSE_VERSION=`sed -n 's/__version__.*=.*\"\(.*\)\"/\1/p' ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py`
12

13
# Check if branch is master
14
if [[ ${MDANSE_GIT_BRANCH_NAME} == "master" ]]
15
16
then
    VERSION_NAME=${MDANSE_VERSION}
eric pellegrini's avatar
eric pellegrini committed
17
    $SED_I_COMMAND "s/.*__beta__.*/__beta__ = None/" ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py
18
else
19
    # Check if branch is release*
20
	if [[ ${MDANSE_GIT_BRANCH_NAME::7} == "release" ]]
21
22
	then
	    VERSION_NAME=${MDANSE_VERSION}-rc-${MDANSE_GIT_CURRENT_COMMIT}
eric pellegrini's avatar
eric pellegrini committed
23
	    $SED_I_COMMAND "s/.*__beta__.*/__beta__ = \"rc\"/" ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py
24
25
	else
	    VERSION_NAME=${MDANSE_VERSION}-beta-${MDANSE_GIT_CURRENT_COMMIT}
eric pellegrini's avatar
eric pellegrini committed
26
	    $SED_I_COMMAND "s/.*__beta__.*/__beta__ = \"beta\"/" ${CI_PROJECT_DIR}/MDANSE/__pkginfo__.py
27
	fi
28
fi
eric pellegrini's avatar
eric pellegrini committed
29
export VERSION_NAME