version.sh 1.04 KB
Newer Older
1
2
3
4
#!/bin/bash

cd $MDANSE_SOURCE_DIR

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}"
8
9
10
11
12
$SED_I_COMMAND "s/.*__commit__.*/__commit__ = \"${MDANSE_GIT_CURRENT_COMMIT}\"/" MDANSE/__pkginfo__.py

# Get MDANSE version
MDANSE_VERSION=`sed -n 's/__version__.*=.*\"\(.*\)\"/\1/p' MDANSE/__pkginfo__.py`

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