CV/.gitlab/ci/cv-gitlab-ci.yml

72 lines
1.6 KiB
YAML
Raw Normal View History

---
#--------------------------------------------#
# Hidden job templates for CV build pipeline #
#--------------------------------------------#
.use-cv-builder:
image: ${IMAGE_NAME}:master-cb8a29c7
.cv-test-rules:
rules:
- changes:
- "docker/Dockerfile"
- "__output/*"
when: never
- when: always
.cv-publish-rules:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_PATH == "dananglin/cv"'
when: always
- changes:
- "docker/Dockerfile"
- "__output/*"
when: never
#------------------------------------#
# Visible jobs for CV build pipeline #
#------------------------------------#
test:spellcheck:
before_script:
- apt-get update
- apt-get -y install aspell make
extends:
- .cv-test-rules
image: ubuntu:18.04
stage: test
script:
- make spellcheck
2020-02-07 16:05:30 +00:00
test:pdf:
artifacts:
expire_in: 1 hour
paths:
- __output/cv.pdf
extends:
- .use-cv-builder
- .cv-test-rules
2020-02-07 16:05:30 +00:00
stage: test
script:
- make clean pdf
2020-02-07 16:05:30 +00:00
publish:pdf:
extends:
- .use-cv-builder
- .cv-publish-rules
before_script:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 0400 ~/.ssh/known_hosts
- git remote set-url origin git@gitlab.com:${CI_PROJECT_PATH}.git
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "${GITLAB_USER_NAME}"
stage: publish
script:
- make clean pdf
- git checkout master
- git add __output/cv.pdf
- 'git commit -m "auto: update CV."'
- git push origin master