-
Notifications
You must be signed in to change notification settings - Fork 43
65 lines (62 loc) · 2.06 KB
/
auto-release-pdfs.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
# Automatycznie tworzy tag na najnowszym commicie,
# generuje PDFy i ZIPa z PDFami,
# w końcu publikuje z tych plików release na tagu.
name: Release z generowanymi PDFami
on:
push:
branches:
- main
paths:
- '*.md'
jobs:
make_release:
runs-on: ubuntu-latest
env:
PDF_DIR_NAME: Ustawy o PIT - PDF
strategy:
matrix:
node-version:
- 12
steps:
- name: Utworzenie git taga pod release
uses: phish108/[email protected]
id: tagger
with:
github-token: ${{ secrets.GITHUB_TOKEN}}
with-v: true
- uses: actions/checkout@v3
- name: Aktualizacja dostępnych zależności
run: sudo apt-get update
- name: Instalacja LaTeX-a
run: sudo apt-get install -y texlive-latex-extra
- name: Instalacja Pandoc-a
run: sudo apt-get install -y pandoc
- name: Generowanie PDFów na podstawie plików Markdown
run: |
# Włącza wyświetlanie wykonywanych poleceń
set -x
mkdir "${{ env.PDF_DIR_NAME }}"
for md_file in ./*.md; do
# https://pandoc.org/MANUAL.html#layout
# https://pandoc.org/MANUAL.html#fonts
# https://texfaq.org/FAQ-hyphoff
# https://stackoverflow.com/a/76329457/666907
pandoc \
"${md_file}" \
--fail-if-warnings \
--pdf-engine pdflatex \
--variable geometry:a4paper \
--variable geometry:margin=2.5cm \
--variable fontsize=12pt \
--variable header-includes="\hyphenpenalty=10000" \
--variable header-includes="\exhyphenpenalty=10000" \
--output "${{ env.PDF_DIR_NAME }}/${md_file%.md}.pdf"
done
zip -r ustawy-o-pit-pdf.zip "${{ env.PDF_DIR_NAME }}"
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ steps.tagger.outputs.new-tag }}"
files: |
${{ env.PDF_DIR_NAME }}/*.pdf
ustawy-o-pit-pdf.zip