52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
variables:
|
|
# https://hub.docker.com/r/alpine/git/tags
|
|
- &GIT_VERSION v2.30.1
|
|
|
|
steps:
|
|
- name: build_tex
|
|
image: registry.gitlab.com/islandoftex/images/texlive:latest
|
|
commands:
|
|
- pdflatex --shell-escape cv.tex
|
|
- cat cv.log
|
|
|
|
- name: deploy
|
|
image: alpine/git:*GIT_VERSION
|
|
commands:
|
|
- mkdir -p ~/.ssh
|
|
- echo "${SSH_KEY}" > ~/.ssh/id_ed25519
|
|
- chmod 600 ~/.ssh/id_ed25519
|
|
- ssh-keyscan -t ed25519 git.polarolouis.fr >> ~/.ssh/known_hosts
|
|
# Clone the repository via HTTPS inside a new directory
|
|
- git clone "${CI_REPO_CLONE_SSH_URL}" "${CI_COMMIT_SHA}"
|
|
|
|
# Set the displayed user with the commits that are about to be made
|
|
- git config --global user.email "${CI_COMMIT_AUTHOR_EMAIL:-$CI_COMMIT_AUTHOR_EMAIL}"
|
|
- git config --global user.name "${CI_COMMIT_AUTHOR:-$CI_COMMIT_AUTHOR}"
|
|
|
|
- mv *.pdf "${CI_COMMIT_SHA}/"
|
|
|
|
# Go to the new directory
|
|
- cd "${CI_COMMIT_SHA}"
|
|
- pwd
|
|
- ls
|
|
|
|
# Add all generated files to Git
|
|
- git add -f *.pdf
|
|
- git status
|
|
- |-
|
|
# Check if we have modifications to commit
|
|
CHANGES=$(git status --porcelain | wc -l)
|
|
|
|
if [ "$CHANGES" -gt "0" ]; then
|
|
# Show the status of files that are about to be created, updated or deleted
|
|
git status
|
|
|
|
# Commit all changes
|
|
git commit -m "Built pdf for ${CI_COMMIT_SHA:0:8}"
|
|
|
|
# Update the repository and make sure to skip the pipeline create for this commit
|
|
git push origin "${CI_REPO_DEFAULT_BRANCH}" -o ci.skip
|
|
fi
|
|
environment:
|
|
SSH_KEY:
|
|
from_secret: SSH-KEY
|