Commit 07c48824 authored by Thomas Fragner's avatar Thomas Fragner
Browse files

Update .gitlab-ci.yml

parent 4a93653e
# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/hugo
image: meroff/hugo-with-pandoc
stages:
- build
- combine
- review
- publish
.build-prepare:
stage: build
before_script:
- git checkout .
- git submodule foreach git checkout .
- git submodule update --init --remote --recursive
- cd themes/academic
- git checkout v2.4.0
- cd ../../
- python3.6 -m venv venv
- source venv/bin/activate
- pip install -r .pandoc/requirements.txt
- cp -purv .pandoc ~/
build-hugo-branches:
extends: .build-prepare
stage: build
script:
- hugo --baseURL https://deploy.ce.jku.at/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/
artifacts:
paths:
- public
only:
- branches
build-hugo-master:
extends: .build-prepare
stage: build
script:
- hugo --baseURL https://pages.ce.jku.at/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/public/
artifacts:
paths:
- public
only:
- master
build-pdf:
extends: .build-prepare
stage: build
script:
- ./bin/compile-pdf.sh
artifacts:
paths:
- build
only:
variables:
- $GENERATE_PDF == "true"
combine:
stage: combine
script:
- if [[ -e build ]] ; then cp -purv build/pdf/content/* public/ ; rm -rf build ; fi
artifacts:
paths:
- public
only:
variables:
- $GENERATE_PDF == "true"
review:
image: meroff/hugo-deploy
stage: review
before_script:
- eval $(ssh-agent -s)
- echo "$PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -p 2122 deploy.ce.jku.at > ~/.ssh/known_hosts
script:
- ssh -p 2122 deploy@deploy.ce.jku.at "mkdir -p /home/deploy/data/deploy/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME"
- rsync -av -e "ssh -p 2122" --delete public/* "deploy@deploy.ce.jku.at:/home/deploy/data/deploy/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"
environment:
name: review/$CI_BUILD_REF_NAME
url: https://deploy.ce.jku.at/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME
on_stop: stop_review
only:
- branches
except:
- master
stop_review:
image: meroff/hugo-deploy
stage: review
before_script:
- eval $(ssh-agent -s)
- echo "$PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -p 2122 deploy.ce.jku.at > ~/.ssh/known_hosts
script:
- ssh -p 2122 deploy@deploy.ce.jku.at "rm -rf /home/deploy/data/deploy/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME"
variables:
GIT_STRATEGY: none
when: manual
environment:
name: review/$CI_BUILD_REF_NAME
action: stop
pages:
stage: publish
script:
- ls -lrta
- echo "Copy To Pages"
artifacts:
paths:
- public
only:
- master
include: 'https://gitlab.ce.jku.at/templates/gitlab-ci-templates/raw/master/.gitlab-ci-for-hugo.yml'
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment