Merge pull request #2 from windcbf/codex/add-opennhp-hackathon-presen… #3
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
| # 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 | |
| # Publish PDFs after changes land on main, or when triggered manually. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| # The deploy action pushes generated PDFs to the pdfs-from-html branch. | |
| permissions: | |
| contents: write | |
| # 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@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./presentations | |
| publish_branch: pdfs-from-html | |
| keep_files: true |