v0.1.0 #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build PDFs | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: [created] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -q | |
| sudo apt-get install -y pandoc | |
| pip install weasyprint | |
| - name: Build PDFs | |
| run: | | |
| mkdir -p dist | |
| for section in people vehicles props; do | |
| echo "Building ${section}..." | |
| files=$(find ${section} -name "*.md" | sort) | |
| cat $files > /tmp/${section}_combined.md | |
| pandoc /tmp/${section}_combined.md \ | |
| --from markdown \ | |
| --to pdf \ | |
| --pdf-engine=weasyprint \ | |
| --metadata title="Autobahn - $(echo ${section} | sed 's/\b\(.\)/\u\1/g')" \ | |
| --metadata date="$(date +%Y-%m-%d)" \ | |
| -o dist/autobahn-${section}.pdf | |
| done | |
| for road in roads/a*; do | |
| name=$(basename $road) | |
| echo "Building ${name}..." | |
| overview="roads/place_the_${name}.md" | |
| files=$(find ${road} -name "*.md" | sort) | |
| if [ -n "$files" ]; then | |
| > /tmp/${name}_combined.md | |
| if [ -f "$overview" ]; then | |
| cat "$overview" >> /tmp/${name}_combined.md | |
| echo -e "\n---\n" >> /tmp/${name}_combined.md | |
| fi | |
| cat $files >> /tmp/${name}_combined.md | |
| pandoc /tmp/${name}_combined.md \ | |
| --from markdown \ | |
| --to pdf \ | |
| --pdf-engine=weasyprint \ | |
| --metadata title="Autobahn - ${name}" \ | |
| --metadata date="$(date +%Y-%m-%d)" \ | |
| -o dist/autobahn-${name}.pdf | |
| fi | |
| done | |
| - name: Upload to release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/*.pdf | |
| - name: Upload as artifacts | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: autobahn-pdfs | |
| path: dist/*.pdf | |
| retention-days: 14 |