Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: autogen pdf from md #2

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
82 changes: 82 additions & 0 deletions .github/workflows/genpdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Start the docs server
run: |
npx live-server docs &
sleep 20

- name: Install dependencies
run: |
npm install puppeteer

- name: Install gowitness
run: |
sudo apt-get update
sudo apt-get install -y libnss3-tools wget
wget https://github.com/sensepost/gowitness/releases/download/2.5.1/gowitness-2.5.1-linux-amd64
mv gowitness-2.5.1-linux-amd64 gowitness
chmod +x gowitness
./gowitness

# - name: Generate URLs
# run: |
# node -e "
# const puppeteer = require('puppeteer');
# (async () => {
# const browser = await puppeteer.launch();
# const page = await browser.newPage();
# await page.goto('http://localhost:8080');
# const numberOfPages = await page.evaluate(() => {
# return document.querySelectorAll('.remark-slide').length;
# });
# const urls = Array.from({ length: numberOfPages }, (_, i) => \`http://localhost:8080/#\${i + 1}\`).join('\\n');
# require('fs').writeFileSync('urls.txt', urls);
# await browser.close();
# })();"

- name: Print Urls
run: |
cat urls.txt
- name: Run gowitness on URLs
run: |
./gowitness file -f urls.txt

- name: Install img2pdf
run: |
sudo apt-get update
sudo apt-get install -y img2pdf

- name: Convert images to PDF
run: |
img2pdf screenshots/*.png -o screenshots/output.pdf

- name: Upload PDF artifact
uses: actions/upload-artifact@v3
with:
name: slides-pdf
path: screenshots/output.pdf
- name: Print Actions run URL
run: |
echo "Download the artifact from: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

Binary file added output.pdf
Binary file not shown.
65 changes: 65 additions & 0 deletions urls.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
http://localhost:8080/#1
http://localhost:8080/#2
http://localhost:8080/#3
http://localhost:8080/#4
http://localhost:8080/#5
http://localhost:8080/#6
http://localhost:8080/#7
http://localhost:8080/#8
http://localhost:8080/#9
http://localhost:8080/#10
http://localhost:8080/#11
http://localhost:8080/#12
http://localhost:8080/#13
http://localhost:8080/#14
http://localhost:8080/#15
http://localhost:8080/#16
http://localhost:8080/#17
http://localhost:8080/#18
http://localhost:8080/#19
http://localhost:8080/#20
http://localhost:8080/#21
http://localhost:8080/#22
http://localhost:8080/#23
http://localhost:8080/#24
http://localhost:8080/#25
http://localhost:8080/#26
http://localhost:8080/#27
http://localhost:8080/#28
http://localhost:8080/#29
http://localhost:8080/#30
http://localhost:8080/#31
http://localhost:8080/#32
http://localhost:8080/#33
http://localhost:8080/#34
http://localhost:8080/#35
http://localhost:8080/#36
http://localhost:8080/#37
http://localhost:8080/#38
http://localhost:8080/#39
http://localhost:8080/#40
http://localhost:8080/#41
http://localhost:8080/#42
http://localhost:8080/#43
http://localhost:8080/#44
http://localhost:8080/#45
http://localhost:8080/#46
http://localhost:8080/#47
http://localhost:8080/#48
http://localhost:8080/#49
http://localhost:8080/#50
http://localhost:8080/#51
http://localhost:8080/#52
http://localhost:8080/#53
http://localhost:8080/#54
http://localhost:8080/#55
http://localhost:8080/#56
http://localhost:8080/#57
http://localhost:8080/#58
http://localhost:8080/#59
http://localhost:8080/#60
http://localhost:8080/#61
http://localhost:8080/#62
http://localhost:8080/#63
http://localhost:8080/#64
http://localhost:8080/#65
Loading