-
-
Notifications
You must be signed in to change notification settings - Fork 22
64 lines (63 loc) · 2.22 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Build Docker Image
on:
push:
pull_request:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
build:
if: "!(github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]'))"
strategy:
matrix:
scheme: [small, full]
name: Build TeXLive [${{ matrix.scheme }}-scheme]
runs-on: ubuntu-latest
env:
SCHEME: ${{ matrix.scheme }}
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Enable Docker experimental features and setup DNS
run: |
jq '.experimental=true | .dns=["1.1.1.1"]' /etc/docker/daemon.json > daemon.json
sudo mv daemon.json /etc/docker/daemon.json
sudo systemctl restart docker
docker version -f '{{.Server.Experimental}}'
- name: Build
run: |
docker build --squash -t texlive-$SCHEME --build-arg scheme=$SCHEME .
- name: Test
run: |
docker run --rm texlive-$SCHEME pdflatex --version
cat <<EOF >test.tex
\documentclass{article}
\usepackage{newtxtext}
\begin{document}
test
\end{document}
EOF
docker run --rm -v $(pwd):/data -w /data texlive-$SCHEME python3 /opt/texlive/texdir/bin/x86_64-linuxmusl/texliveonfly test.tex
file test.pdf | grep -q ' PDF '
- name: Test latexindent
run: |
cat <<EOF >test.tex
\documentclass{article}
\usepackage{newtxtext}
\begin{document}
test
\end{document}
EOF
docker run --rm -v $(pwd):/data -w /data texlive-$SCHEME latexindent test.tex
if: "matrix.scheme == 'full'"
- name: Deploy
run: |
TAG="ghcr.io/xu-cheng/texlive-$SCHEME"
VERSION="$(date "+%Y%m%d")"
docker tag texlive-$SCHEME $TAG:$VERSION
docker tag texlive-$SCHEME $TAG:latest
docker images $TAG
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push $TAG:$VERSION
docker push $TAG:latest
if: "github.ref == 'refs/heads/master' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')"