Skip to content

Commit

Permalink
ci: enable automated compile of the PDF (easier to collaborate)
Browse files Browse the repository at this point in the history
  • Loading branch information
romintomasetti committed Jul 2, 2024
1 parent 612da55 commit 919a84f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build PDF

env:
REGISTRY: ghcr.io

jobs:

set-vars:
runs-on: [ubuntu-latest]
outputs:
CI_IMAGE : ${{ steps.common.outputs.CI_IMAGE }}
steps:
- name: Export common variables.
id : common
run : |
echo "CI_IMAGE=${{ env.REGISTRY }}/${{ github.repository }}/latex" >> $GITHUB_OUTPUT
build-image:
needs: [set-vars]
runs-on: [ubuntu-latest]
container:
image: docker:latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v5
with:
context: .
platforms: linux-amd64
push: true
file: dockerfile
tags: ${{ needs.set-vars.outputs.CI_IMAGE }}
cache-from: type=registry,ref=${{ needs.set-vars.outputs.CI_IMAGE }}
cache-to: type=inline
labels: "org.opencontainers.image.source=${{ github.repositoryUrl }}"

build-pdf:
needs: [set-vars, build-image]
runs-on: [ubuntu-latest]
container:
image: ${{ needs.set-vars.outputs.CI_IMAGE }}
steps:
- uses: actions/checkout@v4

- run: |
make
13 changes: 13 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:24.04

RUN --mount=type=bind,source=requirements.txt,target=requirements.txt <<EOF

set -ex

apt update

apt --yes --no-install-recommends install $(grep -vE "^\s*#" requirements.txt | tr "\n" " ")

rm -rf /var/lib/apt/lists/*

EOF
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
texlive-latex-extra

0 comments on commit 919a84f

Please sign in to comment.