diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ff2d2d8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,42 @@ +# Workflow from https://4comprehension.com/github-actions-reveal-js-and-automating-pdf-conversion/ +# using Decktape https://github.com/astefanutti/decktape +# another option is https://github.com/bellbind/remarkjs-pdf +name: Create-PDF + +# Controls when the workflow will run +# Triggers the workflow on push or pull request events on any branch and when manually +# triggered from the Actions tab +on: [push, pull_request, workflow_dispatch] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + name: Generate PDF + steps: + - name: Create "/presentations" directory + run: mkdir presentations && sudo chmod 777 presentations + + - name: Get List of files + run: + curl https://api.github.com/repos/${{ github.repository }}/contents?ref=main | grep \"name\" | grep \"*.html\", | cut -d \" -f4 > pagefiles.txt + + - name: Build pdfs + run: + for f in `cat pagefiles.txt`; do in="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${f}"; out="presentations/${f%.html}.pdf"; docker run --rm -t -v `pwd`:/slides -v ~:/home/user astefanutti/decktape $in $out; done + + - name: Remove list of files + run: + rm pagefiles.txt + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./presentations + publish_branch: pdfs-from-html + keep_files: true