setup_ci.bat 1.2 KB
Newer Older
1 2 3 4 5 6
@echo off

cd "%MDANSE_SOURCE_DIR%"

rem To understand this syntax "set cmd=...... for /F %%ii ......", see https://stackoverflow.com/questions/2323292/assign-output-of-a-program-to-a-variable

7
rem Update the __pkginfo__ file with the current commit
8
echo "Commit id %MDANSE_GIT_CURRENT_COMMIT%"
9
echo "Branch name %MDANSE_GIT_BRANCH_NAME%"
10 11 12 13 14 15 16
sed -i "s/.*__commit__.*/__commit__ = \"%MDANSE_GIT_CURRENT_COMMIT%\"/" MDANSE/__pkginfo__.py

rem Get MDANSE version
set cmd="sed -n "s/__version__.*=.*\"\(.*\)\"/\1/p" MDANSE/__pkginfo__.py"
for /F %%i in (' %cmd% ') do set MDANSE_VERSION=%%i

rem Check if branch is master, tag as draft otherwise
17
if "%MDANSE_GIT_BRANCH_NAME%" == "master" (
18
    set VERSION_NAME=%MDANSE_VERSION%
19
    sed -i "s/.*__beta__.*/__beta__ = None/" MDANSE/__pkginfo__.py
20
) else (
21
    rem Check if branch is release*
22
    if "%MDANSE_GIT_BRANCH_NAME:~0,7%" == "release" (
23 24 25 26 27 28
        set VERSION_NAME=%MDANSE_VERSION%-rc-%MDANSE_GIT_CURRENT_COMMIT%
        sed -i "s/.*__beta__.*/__beta__ = \"rc\"/" MDANSE/__pkginfo__.py
    ) else (
        set VERSION_NAME=%MDANSE_VERSION%-beta-%MDANSE_GIT_CURRENT_COMMIT%
        sed -i "s/.*__beta__.*/__beta__ = \"beta\"/" MDANSE/__pkginfo__.py
    )
Remi Perenon's avatar
Remi Perenon committed
29
)