-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1.71 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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