diff --git a/.ci/deploy.sh b/.ci/deploy.sh index 54f09d1df4e595b32838802acec0a90a72eb6ce0..34194af99a3d7aae4a71b208939ea5e2cc1704aa 100644 --- a/.ci/deploy.sh +++ b/.ci/deploy.sh @@ -22,8 +22,18 @@ do # create the required folders in public mkdir $rootDir/public mkdir $rootDir/public/$BLADE - mkdir $rootDir/public/$BLADE/stable - mkdir $rootDir/public/$BLADE/latest + + # determine the folder of the branch + if [[ $CI_COMMIT_REF_NAME == "develop"]]; then + dirName="latest" + elif [[ $CI_COMMIT_REF_NAME == "master"]]; then + dirName="stable" + else + dirName="unstable" + fi + + # make the local folder + mkdir $rootDir/public/$BLADE/$dirName # change to the blade directory to be built cd $BLADE @@ -32,22 +42,29 @@ do npm install -g npm@latest yo grunt-cli generator-reveal npm install + if [[ $dirName == "unstable"]]; then + git submodule update --init + grunt dist + mv public/* $rootDir/public/$BLADE/$dirName/. + fi + # build the master version into stable - #git fetch --tags - #latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) - #git checkout $latestTag - #grunt dist - #mv public/* $rootDir/public/$BLADE/stable/. + git fetch --tags + latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) + git checkout $latestTag + git submodule update --init + grunt dist + mv public/* $rootDir/public/$BLADE/$dirName/. # build the develop version into latest - #git checkout -f develop - #git fetch origin develop - #git reset --hard origin/develop + git checkout -f develop + git fetch origin develop + git reset --hard origin/develop git submodule update --init grunt dist - mv public/* $rootDir/public/$BLADE/latest/. + mv public/* $rootDir/public/$BLADE/$dirName/. - # auto redirect file + # auto redirect file to the stable version echo '<html>\n <head>\n <meta http-equiv="refresh" content="0; url='$PAGEURL'/'$BLADE'/stable"/>\n diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5dc5cb26adde1afb1413c5c791eb49e47d54458e..ba64ae34b1fdac81e6d9542a89369635b9927ea4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,11 +2,7 @@ image: digitallyseamless/nodejs-bower-grunt pages: stage: deploy - only: - - develop - - master script: - # install npm - bash .ci/deploy.sh artifacts: