deploy.sh 896 Bytes
Newer Older
Jacek Lebioda's avatar
Jacek Lebioda committed
1
mkdir -p build
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
artefact="latest"

# loop through all the branches
for branch in $(git for-each-ref --format='%(refname:strip=3)' refs/remotes); do
    echo $branch;
    if [[ $branch == "master" ]]; then
        artefact="stable";
    elif [[ $branch == "develop" ]]; then
        artefact="latest";
    else
        artefact="unstable";
    fi
    echo $artefact;
    git checkout -f $branch
    git reset --hard $branch
Jacek Lebioda's avatar
Jacek Lebioda committed
17
    git pull
18
19

    # build the website
Laurent Heirendt's avatar
Laurent Heirendt committed
20
    bundle install
Jacek Lebioda's avatar
Jacek Lebioda committed
21
    bundle exec jekyll build --baseurl="howto-cards/$artefact" -d "build/$artefact"
Jacek Lebioda's avatar
Jacek Lebioda committed
22
23
24

    if [[ $branch == "master" ]]; then
        # set the 404
Jacek Lebioda's avatar
Jacek Lebioda committed
25
        cp howto-cards/$artefact/404.html build/404.html
Jacek Lebioda's avatar
Jacek Lebioda committed
26
    fi
27
28
29
30
31
32
33
34
done

# checkout the current branch
echo $CI_COMMIT_REF_NAME
git checkout -f $CI_COMMIT_REF_NAME
git reset --hard origin/$CI_COMMIT_REF_NAME

# set the auto redirection
Jacek Lebioda's avatar
Jacek Lebioda committed
35
cp .ci/.autoRedirect build/index.html