diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..db44382 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,65 @@ +variables: + # https://hub.docker.com/r/alpine/git/tags + GIT_VERSION: v2.30.1 + +.git:push: + after_script: + # 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 "${COMMIT_MESSAGE}" + + # Update the repository and make sure to skip the pipeline create for this commit + git push origin "${CI_DEFAULT_BRANCH}" -o ci.skip + fi + before_script: + # Clone the repository via HTTPS inside a new directory + - git clone "https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" "${CI_COMMIT_SHA}" + + # Set the displayed user with the commits that are about to be made + - git config --global user.email "${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}" + - git config --global user.name "${GIT_USER_NAME:-$GITLAB_USER_NAME}" + image: + entrypoint: [""] + name: alpine/git:${GIT_VERSION} + stage: deploy + +build_tex: + stage: build + image: registry.gitlab.com/islandoftex/images/texlive:latest + # rules: + # - changes: + # - "./*.tex" + # - "./**/*.tex" + script: + - pdflatex --shell-escape presentation.tex + - biber article + - pdflatex --shell-escape presentation.tex + after_script: + - cat presentation.log + artifacts: + paths: + - presentation.pdf + +deploy: + extends: .git:push + script: + - mv *.pdf "${CI_COMMIT_SHA}/"