Skip to content

Commit c9cdfe3

Browse files
committed
Back to commiting generated files to repository, but in separate folder.The idea of switching to artifacts was to separate the automatic output from the source code and only track changes made by users. However, I did not consider that the script efficiently only generates the output of changed files, such that we end up with artifacts that only contain recent changes, but not a snapshort of the current state of the db. The compromise now is to commit the generated files, but put them into a "generated" subdir, so it remains clear which files are source and which are automatically generated.
1 parent 9385f93 commit c9cdfe3

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

.github/workflows/conditional_convert_via_pandoc.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ jobs:
6262
run: |
6363
echo $list_changed_files
6464
bash ./pandoc.sh $list_changed_files
65-
# - name: Commit files # transfer the new files into the repository
66-
# run: |
67-
# git config --local user.name "GH_Action_Bot"
68-
# git add ./content
69-
# git commit -m "GH Action: Pandoc | New output for changed files"
70-
# git push -f origin main
71-
- name: Save artifacts # Instead of 'Commit files'. Saves the files as .zip
72-
uses: actions/upload-artifact@v4
73-
with:
74-
name: pandoc-artifact
75-
path: content/
65+
- name: Commit files # transfer the new files into the repository
66+
run: |
67+
git config --local user.name "GH_Action_Bot"
68+
git add ./content
69+
git commit -m "GH Action: Pandoc | New output for changed files"
70+
git push -f origin main
71+
# - name: Save artifacts # Instead of 'Commit files'. Saves the files as .zip
72+
# uses: actions/upload-artifact@v4
73+
# with:
74+
# name: pandoc-artifact
75+
# path: content/

pandoc-generator/pandoc-single.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,31 @@ Only_Standalone_Output_Types="latex docx odt"
44
# Pandoc creates an AST (Abstract Syntax Tree); reuse this by saving/reading from .ast
55
# You can add individual pandoc conversions by calling them after the 'done' part. Keep in mind to finish all lines with backslash
66

7-
BASE="${1%.*}"
87
FILENAME=$(basename -- "$1")
98
LOGID="${FILENAME%.*}"
109
SUPPORTDIR=$(dirname "$0")
10+
SRCDIR=$(dirname "$1")
11+
OUTFILE="$SRCDIR/generated/$LOGID"
12+
13+
mkdir -p "$SRCDIR/generated"
1114

1215
echo "PANDOC Processing $1 as $LOGID"
1316

14-
pandoc --from markdown+tex_math_single_backslash --to native "$1" -o "$BASE.ast"
17+
pandoc --from markdown+tex_math_single_backslash --to native "$1" -o "$OUTFILE.ast"
1518
for ext in ${Only_Standalone_Output_Types}; do
1619
echo "$LOGID Genrating $ext"
17-
pandoc --from native "$BASE.ast" --standalone --pdf-engine=lualatex -o "$BASE.$ext"
20+
pandoc --from native "$OUTFILE.ast" --standalone --pdf-engine=lualatex -o "$OUTFILE.$ext"
1821
done
1922

2023
# HTML
2124
echo "$LOGID Generating pdf"
22-
pandoc --from native "$BASE.ast" --standalone --mathml -o "$BASE.html"; \
25+
pandoc --from native "$OUTFILE.ast" --standalone --mathml -o "$OUTFILE.html"; \
2326

2427
# PDF
2528
echo "$LOGID Generating pdf"
26-
pandoc --from native "$BASE.ast" --standalone -H "$SUPPORTDIR/preamble.tex" --pdf-engine=pdflatex -o "$BASE.pdf"; \
29+
pandoc --from native "$OUTFILE.ast" --standalone -H "$SUPPORTDIR/preamble.tex" --pdf-engine=pdflatex -o "$OUTFILE.pdf"; \
2730

2831
echo "$LOGID Cleaning up"
29-
rm "./$BASE.ast"
32+
rm "$OUTFILE.ast"
3033

3134
echo "$LOGID Done."

0 commit comments

Comments
 (0)