generated from gucio321/agh-sphinx-template
-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (110 loc) · 3.42 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build PDF document
on:
push:
branch:
- master
workflow_dispatch:
jobs:
build-pdf:
runs-on: ubuntu-latest
steps:
- name: check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: install ubuntu dependencies
run: |
sudo apt -y update
sudo apt -y install gnuplot
- name: Set up python3
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip' # caching pip dependencies
- name: install python3 dependencies
run: |
pip install -r requirements.txt
pip install setuptools
- name: setup texlive
uses: teatimeguest/setup-texlive-action@v3
with:
version: 2024
packages: |
# to list local packages use: tlmgr info --list --data name
scheme-basic
latexmk
cmap
cancel
tex-gyre
fncychap
float
wrapfig
capt-of
framed
babel-polish
fancyvrb
upquote
needspace
tabulary
varwidth
booktabs
parskip
titlesec
etoolbox
makecell
caption
- name: build PDF
run: make latexpdf
- name: extract file name
run: |
# extract filename from conf.py (it is a value of variable 'project' in lowercase)
echo "filename=$(grep project conf.py | gawk '{gsub(/'\''/,"",$3); print tolower($3)}')" >> $GITHUB_ENV
- name: do some trick ;-)
shell: bash
run: |
echo "The file name is $filename"
stat "_build/latex/${filename}.pdf"
mv "_build/latex/${filename}.pdf" ..
rm -rf *
git add .
git config user.name gucio321
git config user.email [email protected]
mv ../${filename}.pdf .
git add .
git commit --amend --no-edit
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: pdf
force: true
update-url:
needs: [build-pdf]
runs-on: ubuntu-latest
steps:
- name: check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: extract file name
run: |
# extract filename from conf.py (it is a value of variable 'project' in lowercase)
echo "filename=$(grep project conf.py | gawk '{gsub(/'\''/,"",$3); print tolower($3)}')" >> $GITHUB_ENV
- name: edit README
run: |
# replace content of README.md between <!--AUTOURL-BEGIN--> and <!--AUTOURL-END--> with the link to the PDF file
sed -i -e "/\(<\!--AUTOURL-BEGIN-->\)/, /\(<\!--AUTOURL-END-->\)/c\<\!--AUTOURL-BEGIN-->\n<a href=\"https://github.com/${{ github.repository }}/blob/pdf/$filename.pdf\">\n<\!--AUTOURL-END-->" README.md
- name: commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update README.md with the link to the PDF file
commit_options: '--no-verify'
file_pattern: README.md
commit_user_name: gucio321
commit_user_email: [email protected]
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true