commit f7863d079e2223ed068ea3570943ea4593a46f55 Author: Roy Nilsson Date: Wed Dec 20 10:29:05 2023 +0100 Add basic GitHub Action diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6598bbd --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..0a36983 --- /dev/null +++ b/README.md @@ -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: '' +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..49d07ba --- /dev/null +++ b/action.yml @@ -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 }} diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..45ac35b --- /dev/null +++ b/compile.sh @@ -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