PDF schedule gen
This commit is contained in:
rodič
c0c6af5efa
revize
9516396967
|
@ -0,0 +1,35 @@
|
|||
name: Generate schedule PDFs
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 5,17 * * *'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '17'
|
||||
|
||||
- name: Install npm modules
|
||||
run: |
|
||||
cd tools/schedule-pdf && npm install
|
||||
|
||||
- name: Build sources
|
||||
run: make schedule-pdf
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
external_repository: utxo-foundation/pub.utxo.cz
|
||||
personal_token: ${{ secrets.TOKEN_DOCS }}
|
||||
publish_dir: ./dist/22/pdf
|
||||
destination_dir: ./22/pdf
|
4
Makefile
4
Makefile
|
@ -87,3 +87,7 @@ schedule-multi:
|
|||
tmux split-window -d "make schedule num=$(num) append=true"
|
||||
tmux split-window -d "make schedule num=$(num) append=true"
|
||||
tmux attach
|
||||
|
||||
schedule-pdf:
|
||||
mkdir -p dist/22/pdf && cd utils/schedule-pdf && node index.js $(local)
|
||||
|
||||
|
|
|
@ -2833,6 +2833,37 @@
|
|||
- smart-kontrakty
|
||||
- NFT
|
||||
|
||||
- id: nft-combinator
|
||||
name: NFT Combinator [EN]
|
||||
type: campfire
|
||||
duration: 15
|
||||
speakers: []
|
||||
track: nft
|
||||
description: |
|
||||
NFT Combinator is an incubator for digital artists backed by the leading blockchain security company Quantstamp. In the NFT Combinator we help artists break into the digital art world. Our team work with artists on the project's vision, smart contract minting, marketing and go-to-market strategies.
|
||||
tags:
|
||||
- NFT
|
||||
- inkubátor
|
||||
fixed:
|
||||
date: '2022-06-05'
|
||||
|
||||
- id: fire-movement-tomas-campfire
|
||||
name: Navazující diskuze po přednášce FIRE movement
|
||||
type: campfire
|
||||
duration: 15
|
||||
speakers: [ tomas-kryptovlada ]
|
||||
track: spolecnost
|
||||
description: |
|
||||
V případě zájmu si projdeme konkrétní služby, které na cestě k finanční nezávislosti mohou pomoci. A také si ukážeme místa, kde takové aplikace hledat, když jsou ještě méně známé a často tedy výhodnější.
|
||||
tags:
|
||||
- finanční nezávislost
|
||||
- DeFi
|
||||
- lending
|
||||
after:
|
||||
- fire-movement
|
||||
fixed:
|
||||
date: '2022-06-04'
|
||||
|
||||
# Ostatní
|
||||
# ==========================
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
node_modules
|
|
@ -0,0 +1,47 @@
|
|||
const puppeteer = require('puppeteer');
|
||||
const path = require('path');
|
||||
|
||||
const local = process.argv[2] || false;
|
||||
|
||||
const outputDir = '../../dist/22/pdf/'
|
||||
const baseUrl = local ? 'http://localhost:3000' : 'https://utxo.cz'
|
||||
|
||||
async function makePdf (browser, item) {
|
||||
|
||||
const url = baseUrl + item.url
|
||||
console.log(`Opening page '${url}':`)
|
||||
|
||||
const page = await browser.newPage();
|
||||
await page.goto(url, { waitUntil: "networkidle2" })
|
||||
const fn = path.resolve(outputDir, `${item.id}.pdf`)
|
||||
await page.pdf({
|
||||
path: fn,
|
||||
format: item.format || 'a4',
|
||||
scale: 0.7,
|
||||
landscape: true,
|
||||
printBackground: true
|
||||
|
||||
});
|
||||
console.log(`PDF saved: ${fn}`)
|
||||
await page.close()
|
||||
return true
|
||||
}
|
||||
|
||||
async function run () {
|
||||
|
||||
const browser = await puppeteer.launch();
|
||||
|
||||
const items = [
|
||||
{ id: 'sobota', url: '/program?time=0', format: 'a3' },
|
||||
{ id: 'sobota-party', url: '/program?time=1', format: 'a4' },
|
||||
{ id: 'nedele', url: '/program?time=2', format: 'a3' }
|
||||
]
|
||||
|
||||
for (const item of items) {
|
||||
await makePdf(browser, item)
|
||||
}
|
||||
await browser.close()
|
||||
}
|
||||
|
||||
|
||||
run()
|
Rozdílový obsah nebyl zobrazen, protože je příliš veliký
Načíst rozdílové porovnání
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "schedule-pdf",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"puppeteer": "^14.1.1"
|
||||
}
|
||||
}
|
Načítá se…
Odkázat v novém úkolu