0

I need your help with the following problem. I'm trying to compile a .tex document in GitLab and put my compiled .pdf file in the root repo. I have created a .gitlab-ci.yml file which has the following configuration:

# Use the latest version of the TeX Live Docker image
image: texlive/texlive:latest

# Define a single stage named "build"
stages:
  - build

# Configuration for the "build" stage
build:
  stage: build
  # Specify the events that trigger the pipeline
  only:
    - push
  # Specify the commands to be executed in the pipeline
  script:
    - filename="main"
    - echo "Running latexmk with lualatex"
    - latexmk -pdf -pdflatex="lualatex %O %S" "$filename.tex"
    - echo "Moving .pdf file to root directory"
    - mv "$filename.pdf" ../
    - echo "Listing contents of root directory"
    - ls ../

The log file tells me the following

Latexmk: All targets () are up-to-date
$ echo "Moving .pdf file to root directory"
Moving .pdf file to root directory
$ mv "$filename.pdf" ../
$ echo "Listing contents of root directory"
Listing contents of root directory
$ ls ../
PhD
PhD.tmp
main.pdf
Cleaning up project directory and file based variables
Job succeeded

However, when I access my repo, I do not find any main.pdf file loaded. How can I solve this problem? Is there something I don't understand?

1 Answer 1

0

In the log you should see the line

$ mv "$filename.pdf" ../

This means your variable did not expand.

In the gitlab's yaml syntax, you need to define variables:

job:
   variables:
      var1: "apple"
      var2: "orange"

So your script should be

# Configuration for the "build" stage
build:
  stage: build
  # Specify the events that trigger the pipeline
  only:
    - push
  variables:
    filename: "main"
  # Specify the commands to be executed in the pipeline
  script:
    - echo "Running latexmk with lualatex"
    - latexmk -pdf -pdflatex="lualatex %O %S" "$filename.tex"

Read here: https://docs.gitlab.com/ee/ci/variables/

1
  • Thank you for your help with my issue. I followed your advice and inserted the variable, but unfortunately, I'm still unable to see the compiled PDF file.
    – Mafsi
    Feb 21, 2023 at 14:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .