name: asciidoctor-ghpages
on:
  push:
    paths:
      - 'docs/**'

jobs:
  build:
    runs-on: ubuntu-latest
    container: asciidoctor/docker-asciidoctor
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
    - name: Generate HTML
      run: asciidoctor -b html5 -r asciidoctor-bibtex -a bibtex-file=docs/references.bib docs/adf-manual.adoc -o docs/index.html
    - name: Generate PDF
      run: asciidoctor-pdf -r asciidoctor-bibtex -r asciidoctor-mathematical -a bibtex-file=docs/references.bib -a mathematical-format=svg -a optimize -a pdf-theme=docs/resources/themes/manual.yml -a pdf-fontsdir=docs/resources/fonts docs/adf-manual.adoc -o docs/adf-manual.pdf
    - name: Deploy to GitHub Pages
      uses: crazy-max/ghaction-github-pages@v2
      with:
        target_branch: gh-pages
        build_dir: docs
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
