-
Notifications
You must be signed in to change notification settings - Fork 2
46 lines (39 loc) · 1.1 KB
/
genpdf.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
43
44
45
46
name: Convert MD to PDF
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
convert-webpage:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
npm install puppeteer
npm install live-server
- name: Start live-server to serve the webpage
run: |
npx live-server docs &
sleep 5
- name: Convert webpage to PDF using puppeteer
run: |
node -e "
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('http://localhost:8080/#', { waitUntil: 'networkidle2' });
await page.pdf({ path: 'docs/slides.pdf', format: 'A4' });
await browser.close();
})();
"
- name: Upload PDF artifact
uses: actions/upload-artifact@v3
with:
name: slides-pdf
path: docs/slides.pdf