Github actions
This means, you can run a virtual machine with linux commands to do somethind with your files
Overall structure
name: Convert Hugo Posts to PDF
on:
# This is to run the action manually
workflow_dispatch:
# this works when you cchange an post file called index.md
push:
paths:
- 'content/**/index.md'
jobs:
convert:
runs-on: ubuntu-latest
permissions: # important in case you want to create new files
contents: write
steps:
- name: Checkout repo
uses: actions/checkout@v3
# install packages you need
- name: Install pandoc and yq (for reading front matter)
# install all
run: |
sudo apt-get update
sudo apt-get install -y pandoc texlive-xetex texlive-fonts-recommended texlive-latex-recommended
# Here run the actual code
- name: make a backup file for each md file
run: |
set -e
shopt -s globstar nullglob
for file in content/**/index.md; do
echo "$file"
done
# make sure the files you generate get commited in the repository
- name: Commit generated PDFs
run: |
git config user.name github-actions
git config user.email [email protected]
find content -type f -name post.pdf -exec git add {} \;
#git add content/**/post.pdf # SPECIFIC TEST change to general
git commit -m "Auto-generate post PDFs by title" || echo "No changes to commit"
git push