Add basic GitHub Action

This commit is contained in:
2023-12-20 10:29:05 +01:00
commit f7863d079e
4 changed files with 78 additions and 0 deletions

9
Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM alpine:3.19
RUN apk add --no-cache --upgrade \
texlive-full
ADD build.sh /
RUN chmod +x /compile.sh
ENTRYPOINT ["/compile.sh"]

30
README.md Normal file
View File

@@ -0,0 +1,30 @@
# TeXLive Action
Based on [TeXLive Action](https://github.com/repaction/texlive).
Example usage:
```yaml
name: Compile and deploy TeX documents
run-name: Compile and deploy TeX documents
on:
push:
branches:
- main
jobs:
build_tex:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Compile TeX documents
uses: https://git.roy.lv/actions/texlive-action # Full URL is Gitea Actions specific
with:
tex_files: >-
file1.tex
file2.tex
compiler: xelatex
options: ''
```

22
action.yml Normal file
View File

@@ -0,0 +1,22 @@
name: TeXLive Action
description: Compile TeX documents into PDF with TeXLive
branding:
icon: printer
color: blue
inputs:
files:
description: TeX files to be compiled.
required: true
compiler:
description: The TeX engine to be used.
default: xelatex
options:
description: Arguments to be passed to the TeX compiler
default: ''
runs:
using: docker
image: Dockerfile
args:
- ${{ inputs.files }}
- ${{ inputs.compiler }}
- ${{ inputs.options }}

17
compile.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -euo pipefail
files="$1"
compiler="$2"
options="$3"
for f in $files; do
if [-f "$f" ]; then
echo "Compiling '$f'.."
$compiler $options $f
$compiler $options $f # Run twice to make sure everything is OK
else
echo "'$f' not found!"
fi
done