Skip to content

Commit 0f3ba56

Browse files
zydouxu-cheng
authored andcommitted
feat: add an option to select texlive version directly
1 parent 7efc1fe commit 0f3ba56

5 files changed

Lines changed: 71 additions & 30 deletions

File tree

.dockerignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,24 @@ on:
77
workflow_dispatch:
88
jobs:
99
test:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
texlive_version: [2020, 2021, 2022, latest]
1014
runs-on: ubuntu-latest
1115
steps:
1216
- name: Set up Git repository
1317
uses: actions/checkout@v3
1418
- name: Compile basic LaTeX document
1519
uses: ./
1620
with:
21+
texlive_version: ${{ matrix.texlive_version }}
1722
root_file: test.tex
1823
working_directory: test/
1924
- name: Compile LaTeX document with pre/post compile actions
2025
uses: ./
2126
with:
27+
texlive_version: ${{ matrix.texlive_version }}
2228
root_file: test.tex
2329
working_directory: test/
2430
pre_compile: |
@@ -28,55 +34,64 @@ jobs:
2834
- name: Compile multiple LaTeX documents
2935
uses: ./
3036
with:
37+
texlive_version: ${{ matrix.texlive_version }}
3138
root_file: |
3239
file1.tex
3340
file2.tex
3441
working_directory: test/
3542
- name: Compile multiple LaTeX documents using glob
3643
uses: ./
3744
with:
45+
texlive_version: ${{ matrix.texlive_version }}
3846
root_file: "glob_test*.tex"
3947
glob_root_file: true
4048
working_directory: test/
4149
- name: Compile multiple LaTeX documents in different directories
4250
uses: ./
4351
with:
52+
texlive_version: ${{ matrix.texlive_version }}
4453
root_file: "subdir*/main.tex"
4554
glob_root_file: true
4655
working_directory: test/
4756
work_in_root_file_dir: true
4857
- name: Compile multiple LaTeX documents in different directories using extended glob
4958
uses: ./
5059
with:
60+
texlive_version: ${{ matrix.texlive_version }}
5161
root_file: "extglob/!(subdir3)_glob/*.tex"
5262
glob_root_file: true
5363
working_directory: test/
5464
work_in_root_file_dir: true
5565
- name: Compile multiple LaTeX documents in different directories using glob star
5666
uses: ./
5767
with:
68+
texlive_version: ${{ matrix.texlive_version }}
5869
root_file: "globstar/**/*.tex"
5970
glob_root_file: true
6071
working_directory: test/
6172
work_in_root_file_dir: true
6273
- name: Compile LaTeX document with math symbols
6374
uses: ./
6475
with:
76+
texlive_version: ${{ matrix.texlive_version }}
6577
root_file: math.tex
6678
working_directory: test/
6779
- name: Compile LaTeX document with biblatex/biber
6880
uses: ./
6981
with:
82+
texlive_version: ${{ matrix.texlive_version }}
7083
root_file: biblatex.tex
7184
working_directory: test/
7285
- name: Compile LaTeX document with eps figure
7386
uses: ./
7487
with:
88+
texlive_version: ${{ matrix.texlive_version }}
7589
root_file: eps.tex
7690
working_directory: test/
7791
- name: Compile LaTeX document with minted and lualatex
7892
uses: ./
7993
with:
94+
texlive_version: ${{ matrix.texlive_version }}
8095
root_file: minted.tex
8196
working_directory: test/
8297
latexmk_shell_escape: true
@@ -87,20 +102,23 @@ jobs:
87102
- name: Compile LaTeX document with extra_fonts
88103
uses: ./
89104
with:
105+
texlive_version: ${{ matrix.texlive_version }}
90106
root_file: extra_fonts.tex
91107
working_directory: test/
92108
latexmk_use_xelatex: true
93109
extra_fonts: "./../DoulosSIL-Regular.ttf"
94110
- name: Compile LaTeX document with arara and graphviz
95111
uses: ./
96112
with:
113+
texlive_version: ${{ matrix.texlive_version }}
97114
root_file: graphviz.tex
98115
working_directory: test/
99116
compiler: arara
100117
args: "--verbose"
101118
- name: Compile LaTeX document with continue_on_error
102119
uses: ./
103120
with:
121+
texlive_version: ${{ matrix.texlive_version }}
104122
root_file: |
105123
error.tex
106124
not_error.tex

Dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

action.yml

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,54 @@ inputs:
3535
description: Instruct latexmk to use LuaLaTeX
3636
latexmk_use_xelatex:
3737
description: Instruct latexmk to use XeLaTeX
38+
texlive_version:
39+
description: The version of TeX Live to be used
40+
default: latest
41+
3842
runs:
39-
using: docker
40-
image: Dockerfile
41-
args:
42-
- ${{ inputs.root_file }}
43-
- ${{ inputs.glob_root_file }}
44-
- ${{ inputs.working_directory }}
45-
- ${{ inputs.work_in_root_file_dir }}
46-
- ${{ inputs.continue_on_error }}
47-
- ${{ inputs.compiler }}
48-
- ${{ inputs.args }}
49-
- ${{ inputs.extra_packages }}
50-
- ${{ inputs.extra_system_packages }}
51-
- ${{ inputs.extra_fonts }}
52-
- ${{ inputs.pre_compile }}
53-
- ${{ inputs.post_compile }}
54-
- ${{ inputs.latexmk_shell_escape }}
55-
- ${{ inputs.latexmk_use_lualatex }}
56-
- ${{ inputs.latexmk_use_xelatex }}
43+
using: composite
44+
steps:
45+
- shell: bash
46+
name: Choose pinned texlive docker tag
47+
run: |
48+
if [[ "${{ inputs.texlive_version }}" == "2020" ]]; then
49+
echo "texlive_version=20210301" >> "${GITHUB_ENV}"
50+
elif [[ "${{ inputs.texlive_version }}" == "2021" ]]; then
51+
echo "texlive_version=20220201" >> "${GITHUB_ENV}"
52+
elif [[ "${{ inputs.texlive_version }}" == "2022" ]]; then
53+
echo "texlive_version=20230301" >> "${GITHUB_ENV}"
54+
elif [[ "${{ inputs.texlive_version }}" == "latest" ]]; then
55+
echo "texlive_version=latest" >> "${GITHUB_ENV}"
56+
else
57+
echo "TeX Live version ${{ inputs.texlive_version }} is not supported."
58+
echo "The currently supported versions are 2020, 2021, 2022, and latest."
59+
exit 1
60+
fi
61+
- shell: bash
62+
run: >
63+
docker run --rm
64+
-v "${PWD}":/github/workspace
65+
-v "${GITHUB_ACTION_PATH}/entrypoint.sh":/entrypoint.sh
66+
-w /github/workspace
67+
--entrypoint "/entrypoint.sh"
68+
ghcr.io/xu-cheng/texlive-full:${{ env.texlive_version }}
69+
"${{ inputs.root_file }}"
70+
"${{ inputs.glob_root_file }}"
71+
"${{ inputs.working_directory }}"
72+
"${{ inputs.work_in_root_file_dir }}"
73+
"${{ inputs.continue_on_error }}"
74+
"${{ inputs.compiler }}"
75+
"${{ inputs.args }}"
76+
"${{ inputs.extra_packages }}"
77+
"${{ inputs.extra_system_packages }}"
78+
"${{ inputs.extra_fonts }}"
79+
"${{ inputs.pre_compile }}"
80+
"${{ inputs.post_compile }}"
81+
"${{ inputs.latexmk_shell_escape }}"
82+
"${{ inputs.latexmk_use_lualatex }}"
83+
"${{ inputs.latexmk_use_xelatex }}"
84+
"${{ env.texinputs }}"
85+
5786
branding:
5887
icon: book
5988
color: blue

entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ post_compile="${12}"
3131
latexmk_shell_escape="${13}"
3232
latexmk_use_lualatex="${14}"
3333
latexmk_use_xelatex="${15}"
34+
env_texinputs="${16}"
3435

3536
# install git on old images
3637
if ! command -v git &>/dev/null; then
3738
apk --no-cache add git
3839
fi
3940
git config --system --add safe.directory /github/workspace
4041

42+
# setup user-defined environment variables
43+
if [[ -n "$env_texinputs" ]]; then
44+
export TEXINPUTS="$env_texinputs"
45+
fi
46+
4147
if [[ -z "$root_file" ]]; then
4248
error "Input 'root_file' is missing."
4349
fi

0 commit comments

Comments
 (0)