CV/.gitlab/ci/cv-gitlab-ci.yml
Dan Anglin 5fd72b045a
refactor: replace make with mage
This commit removes the Makefile and uses mage to build the CV files and Docker images.

Changes include:

- All make targets are re-written in go in magefile.go
- The spellcheck script is now written in go and is part of the magefile
- Created mage.go to remove dependency on a mage binary
- Updated CI pipelines to use mage
- Removed unused Makefile
- Removed unused spellcheck bash script
- Cleaned up .gitignore
- Updated .aspell/.aspell.en.pws

NOTE: The updated pipeline for generating the docker image is untested for this MR.
2020-08-09 05:08:30 +01:00

69 lines
1.6 KiB
YAML

---
#--------------------------------------------#
# Hidden job templates for CV build pipeline #
#--------------------------------------------#
.use-cv-builder:
image: ${IMAGE_NAME}:master-cb8a29c7
.cv-test-rules:
rules:
- changes:
- "docker/Dockerfile"
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"
when: never
#------------------------------------#
# Visible jobs for CV build pipeline #
#------------------------------------#
test:spellcheck:
before_script:
- apt-get update
- apt-get -y install aspell aspell-en
extends:
- .cv-test-rules
- .use-cv-builder
stage: test
script:
- go run mage.go spellcheck
test:pdf:
artifacts:
expire_in: 1 hour
paths:
- __output/cv.pdf
extends:
- .use-cv-builder
- .cv-test-rules
stage: test
script:
- go run mage.go pdf
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:
- go run mage.go pdf
- git checkout master
- git add __output/cv.pdf
- 'git commit -m "auto: [skip ci] update CV."'
- git push origin master