Skip to content

Commit c1155a3

Browse files
committed
add github workflow
1 parent 5b48854 commit c1155a3

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/main.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Workflow from https://4comprehension.com/github-actions-reveal-js-and-automating-pdf-conversion/
2+
# using Decktape https://github.com/astefanutti/decktape
3+
# another option is https://github.com/bellbind/remarkjs-pdf
4+
name: Create-PDF
5+
6+
# Controls when the workflow will run
7+
# Triggers the workflow on push or pull request events on any branch and when manually
8+
# triggered from the Actions tab
9+
on: [push, pull_request, workflow_dispatch]
10+
11+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12+
jobs:
13+
# This workflow contains a single job called "build"
14+
build:
15+
# The type of runner that the job will run on
16+
runs-on: ubuntu-latest
17+
18+
# Steps represent a sequence of tasks that will be executed as part of the job
19+
name: Generate PDF
20+
steps:
21+
- name: Create "/presentations" directory
22+
run: mkdir presentations && sudo chmod 777 presentations
23+
24+
- name: Get List of files
25+
run:
26+
curl https://api.github.com/repos/${{ github.repository }}/contents?ref=main | grep \"name\" | grep \"*.html\", | cut -d \" -f4 > pagefiles.txt
27+
28+
- name: Build pdfs
29+
run:
30+
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
31+
32+
- name: Remove list of files
33+
run:
34+
rm pagefiles.txt
35+
36+
- name: Deploy
37+
uses: peaceiris/actions-gh-pages@v3
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
publish_dir: ./presentations
41+
publish_branch: pdfs-from-html
42+
keep_files: true

0 commit comments

Comments
 (0)