Skip to content

Commit b8276ba

Browse files
committed
add support for installing additional system packages
1 parent 7a55371 commit b8276ba

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

.github/workflows/test.yml

+8
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,16 @@ jobs:
2020
root_file: biblatex.tex
2121
working_directory: test/
2222
extra_packages: biblatex-ieee
23+
- name: Compile LaTeX document with minted
24+
uses: ./
25+
with:
26+
root_file: minted.tex
27+
working_directory: test/
28+
extra_system_packages: py-pygments
29+
args: "-pdf -shell-escape -file-line-error -interaction=nonstopmode"
2330
- name: Check pdf file
2431
run: |
2532
set -e
2633
file test/test.pdf | grep -q ' PDF '
2734
file test/biblatex.pdf | grep -q ' PDF '
35+
file test/minted.pdf | grep -q ' PDF '

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ It runs in the docker with a minimal [TeXLive](https://www.tug.org/texlive/) env
2424

2525
* `extra_packages`
2626

27-
The extra packages to be installed by `tlmgr` separated by space. Sometimes, `texliveonfly` will fail to find the missing packages. In this case, you can pass them explicitly. For example, `extra_packages: "biblatex-trad biblatex-ieee"` will install packages `biblatex-trad` and `biblatex-ieee`.
27+
The extra packages to be installed by [`tlmgr`](https://www.tug.org/texlive/tlmgr.html) separated by space. Sometimes, `texliveonfly` will fail to find the missing packages. In this case, you can pass them explicitly. For example, `extra_packages: "biblatex-trad biblatex-ieee"` will install packages `biblatex-trad` and `biblatex-ieee`.
28+
29+
* `extra_system_packages`
30+
31+
The extra packages to be installed by [`apk`](https://pkgs.alpinelinux.org/packages) separated by space. For example, `extra_system_packages: "py-pygments"` will install the package `py-pygments` to be used by the `minted` for code highlights.
2832

2933
## Example
3034

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ inputs:
1515
default: "-pdf -file-line-error -interaction=nonstopmode"
1616
extra_packages:
1717
description: Install extra packages by tlmgr
18+
extra_system_packages:
19+
description: Install extra packages by apk
1820
runs:
1921
using: docker
2022
image: Dockerfile
@@ -24,6 +26,7 @@ runs:
2426
- ${{ inputs.compiler }}
2527
- ${{ inputs.args }}
2628
- ${{ inputs.extra_packages }}
29+
- ${{ inputs.extra_system_packages }}
2730
branding:
2831
icon: book
2932
color: blue

entrypoint.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ working_directory="$2"
77
compiler="$3"
88
args="$4"
99
extra_packages="$5"
10+
extra_system_packages="$6"
11+
12+
if [ -n "$extra_system_packages" ]; then
13+
for pkg in $extra_system_packages; do
14+
echo "Install $pkg by apk"
15+
apk --no-cache add "$pkg"
16+
done
17+
fi
1018

1119
if [ -n "$extra_packages" ]; then
1220
tlmgr update --self
1321
for pkg in $extra_packages; do
14-
echo "Install $pkg"
22+
echo "Install $pkg by tlmgr"
1523
tlmgr install "$pkg"
1624
done
1725
fi

test/minted.tex

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
\documentclass{article}
2+
\usepackage{minted}
3+
\begin{document}
4+
\begin{minted}{c}
5+
int main() {
6+
printf("hello, world");
7+
return 0;
8+
}
9+
\end{minted}
10+
\end{document}

0 commit comments

Comments
 (0)