-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b48854
commit c1155a3
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |