mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-13 16:26:50 +00:00
🛠 Content updates and build trigger
This commit is contained in:
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -1,12 +1,18 @@
|
|||||||
name: build
|
name: build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
# Run the build for pushes and pull requests targeting master
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
# Used to trigger the build for Anchor feed updates. Can by kicked off via:
|
||||||
|
# curl -X POST -H "Authorization: token $GH_PAT" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/Einundzwanzig-Podcast/einundzwanzig.space/dispatches --data '{"event_type": "build_docs"}'
|
||||||
|
repository_dispatch:
|
||||||
|
types:
|
||||||
|
- anchor_update
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
/generated
|
/generated
|
||||||
/log
|
/log
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/tasks/.check-feed
|
||||||
|
|||||||
@@ -11,5 +11,16 @@
|
|||||||
"appleUrl": "https://podcasts.apple.com/de/podcast/einundzwanzig-der-bitcoin-podcast/id1488229907",
|
"appleUrl": "https://podcasts.apple.com/de/podcast/einundzwanzig-der-bitcoin-podcast/id1488229907",
|
||||||
"overcastUrl": "https://overcast.fm/itunes1488229907/einundzwanzig-der-bitcoin-podcast",
|
"overcastUrl": "https://overcast.fm/itunes1488229907/einundzwanzig-der-bitcoin-podcast",
|
||||||
"anchorUrl": "https://anchor.fm/einundzwanzig",
|
"anchorUrl": "https://anchor.fm/einundzwanzig",
|
||||||
"feedUrl": "https://anchor.fm/s/d8d3c38/podcast/rss"
|
"feedUrl": "https://anchor.fm/s/d8d3c38/podcast/rss",
|
||||||
|
"ticker": [
|
||||||
|
"Sende uns einen Shout-Out: 50.000 Sats und du bist dabei",
|
||||||
|
"\"Hosp oder top!\" ist Spiel des Jahres 2020",
|
||||||
|
"Sei kein Holger, lass einen Fullnode laufen!",
|
||||||
|
"Sei kein Vollknoten, komm in die Gruppe!",
|
||||||
|
"Markus ist bester Mann des Monats",
|
||||||
|
"Heute ist ein guter Tag um Sats zu stapeln",
|
||||||
|
"Besseres Geld, bessere Welt",
|
||||||
|
"Inflation ist eine versteckte Steuer",
|
||||||
|
"Neues Specter Desktop Update veröffentlicht"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
6280
package-lock.json
generated
6280
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@@ -11,21 +11,21 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf dist generated && mkdir -p dist generated",
|
"clean": "rm -rf dist generated && mkdir -p dist generated",
|
||||||
"fetch": "node tasks/fetch_feed.js",
|
"fetch": "node tasks/fetch_feed.js",
|
||||||
"start": "npm-run-all clean fetch -p build:static start:*",
|
"copy": "cp -r static/* dist && cp node_modules/amplitudejs/dist/amplitude.min.js dist/js/amplitude.js",
|
||||||
|
"init": "npm-run-all clean -p fetch copy build:data",
|
||||||
|
"start": "npm-run-all init -p start:*",
|
||||||
|
"start:data": "onchange -k 'content/**/*' -- npm run build:data",
|
||||||
"start:pages": "onchange -i -k 'pug.config.js' 'markdown.js' 'content/**' 'generated/**' 'src/**/*.pug' 'src/**/*.svg' 'tasks/generate_pages.js' -- npm run build:pages",
|
"start:pages": "onchange -i -k 'pug.config.js' 'markdown.js' 'content/**' 'generated/**' 'src/**/*.pug' 'src/**/*.svg' 'tasks/generate_pages.js' -- npm run build:pages",
|
||||||
"start:styles": "onchange -i -k 'src/**/*.css' -- npm run build:styles",
|
"start:styles": "onchange -i -k 'src/**/*.css' -- npm run build:styles",
|
||||||
"start:data": "onchange -i -k 'content/**/*' -- npm run build:data",
|
|
||||||
"start:serve": "browser-sync start --config browser-sync.config.js --watch",
|
"start:serve": "browser-sync start --config browser-sync.config.js --watch",
|
||||||
"build": "npm-run-all clean fetch -p build:*",
|
"build": "npm-run-all init -p build:*",
|
||||||
"build:static": "cp -r static/* dist && cp node_modules/amplitudejs/dist/amplitude.min.js dist/js/amplitude.js",
|
|
||||||
"build:data": "node tasks/generate_site_data.js",
|
"build:data": "node tasks/generate_site_data.js",
|
||||||
"build:pages": "node tasks/generate_pages.js",
|
"build:pages": "node tasks/generate_pages.js",
|
||||||
"build:styles": "postcss src/css/main.css --output dist/css/main.css",
|
"build:styles": "postcss src/css/main.css --output dist/css/main.css",
|
||||||
"optimize": "npm-run-all -p optimize:* -s rev",
|
"optimize": "npm-run-all -p optimize:* -s rev",
|
||||||
"optimize:styles": "csso dist/css/main.css --output dist/css/main.css",
|
"optimize:styles": "csso dist/css/main.css --output dist/css/main.css",
|
||||||
"rev": "node-file-rev --manifest=generated/rev.json --root=dist dist/css/* dist/js/* dist/img/*.svg dist/img/cover/*.png dist/img/team/*.jpg dist/img/team/*.png",
|
"rev": "node-file-rev --manifest=generated/rev.json --root=dist dist/css/* dist/js/* dist/img/*.svg dist/img/cover/*.png dist/img/team/*.jpg dist/img/team/*.png",
|
||||||
"prod": "npm-run-all build optimize -s build:pages",
|
"prod": "npm-run-all build optimize -s build:pages"
|
||||||
"images": "node tasks/optimize_images.js"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"amplitudejs": "5.2.0"
|
"amplitudejs": "5.2.0"
|
||||||
@@ -47,13 +47,7 @@
|
|||||||
"postcss-media-variables": "2.0.1",
|
"postcss-media-variables": "2.0.1",
|
||||||
"postcss-nesting": "7.0.1",
|
"postcss-nesting": "7.0.1",
|
||||||
"pug-cli": "1.0.0-alpha6",
|
"pug-cli": "1.0.0-alpha6",
|
||||||
"rss-parser": "3.9.0"
|
"rss-parser": "3.9.0",
|
||||||
},
|
"sync-request": "6.1.0"
|
||||||
"optionalDependencies": {
|
|
||||||
"compress-images": "1.9.5",
|
|
||||||
"gifsicle": "5.1.0",
|
|
||||||
"mozjpeg": "7.0.0",
|
|
||||||
"pngquant-bin": "6.0.0",
|
|
||||||
"svgo": "1.3.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,15 @@ html(lang="en")
|
|||||||
= " und "
|
= " und "
|
||||||
a(href=site.meta.telegramUrl target="_blank") komm in die Gruppe
|
a(href=site.meta.telegramUrl target="_blank") komm in die Gruppe
|
||||||
|!
|
|!
|
||||||
|
if site.block
|
||||||
|
p
|
||||||
|
| Aktualisiert um
|
||||||
|
= " "
|
||||||
|
a(href=`https://www.blockstream.info/block-height/${site.block}`)
|
||||||
|
time(datetime=site.date)= site.block
|
||||||
|
|.
|
||||||
p
|
p
|
||||||
| Made with 💛 by
|
| Made with 💛 by
|
||||||
= " "
|
= " "
|
||||||
a(href="https://d11n.net" target="_blank") d11n.
|
a(href="https://d11n.net" target="_blank") d11n
|
||||||
|
|.
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
extends /template.pug
|
extends /template.pug
|
||||||
|
|
||||||
block main
|
block main
|
||||||
- const ticker = "Toximalistisches Infotainment für bullishe Bitcoiner +++ Sende uns einen Shout-Out: 50.000 Sats und du bist dabei +++ Alpenzitadelle läuft, wir spielen Hosp oder top! +++ Sei kein Holger, lass einen Vollknoten laufen! +++ Sei kein Vollknoten, komm in die Gruppe ! +++ Markus, ist bester Mann des Monats +++ "
|
- const ticker = shuffle(site.meta.ticker).join(" +++ ") + " +++ "
|
||||||
.ticker
|
.ticker
|
||||||
.inner
|
.inner
|
||||||
pre= ticker
|
pre= ticker
|
||||||
pre= ticker
|
pre= ticker
|
||||||
pre= ticker
|
|
||||||
|
|
||||||
.wrap
|
.wrap
|
||||||
section
|
section
|
||||||
|
|||||||
30
tasks/check-feed.sh
Executable file
30
tasks/check-feed.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
dir=$(dirname "$0")
|
||||||
|
log="$dir/check-feed.log"
|
||||||
|
file="$dir/.check-feed"
|
||||||
|
prev=$(cat $file)
|
||||||
|
feed=$(curl -s https://anchor.fm/s/d8d3c38/podcast/rss)
|
||||||
|
date=$(echo "$feed" | awk 'BEGIN { FS="<|>"; RS="\n" }; { if ($0 ~ /lastBuildDate/) print $3}')
|
||||||
|
|
||||||
|
if [[ ! -z "$date" ]]; then
|
||||||
|
echo "Latest build: $prev"
|
||||||
|
echo "Last updated: $date"
|
||||||
|
|
||||||
|
if [[ "$date" != "$prev" ]]; then
|
||||||
|
if [[ ! -z "$GH_PAT" ]]; then
|
||||||
|
echo "-> Triggering new build"
|
||||||
|
curl -X POST https://api.github.com/repos/Einundzwanzig-Podcast/einundzwanzig.space/dispatches \
|
||||||
|
-H "Authorization: token $GH_PAT" \
|
||||||
|
-H "Accept: application/vnd.github.everest-preview+json" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data '{"event_type": "anchor_update"}'
|
||||||
|
|
||||||
|
echo $date >> $log
|
||||||
|
else
|
||||||
|
echo "Missing GH_PAT environment variable!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $date > $file
|
||||||
|
fi
|
||||||
@@ -1,12 +1,22 @@
|
|||||||
const { writeFileSync } = require('fs')
|
const { writeFileSync } = require('fs')
|
||||||
const { join, resolve } = require('path')
|
const { join, resolve } = require('path')
|
||||||
|
const request = require('sync-request')
|
||||||
|
|
||||||
const meta = require('../content/meta.json')
|
const meta = require('../content/meta.json')
|
||||||
|
|
||||||
const dir = resolve(__dirname, '..', 'generated')
|
const dir = resolve(__dirname, '..', 'generated')
|
||||||
const dst = join(dir, 'site-data.json')
|
const dst = join(dir, 'site-data.json')
|
||||||
|
|
||||||
|
let recentBlocks = []
|
||||||
|
try {
|
||||||
|
const jsonBody = request('GET', 'https://mempool.observer/api/recentBlocks').getBody('utf8')
|
||||||
|
recentBlocks = JSON.parse(jsonBody)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Could not load recent blocks:', err)
|
||||||
|
}
|
||||||
|
|
||||||
|
const block = recentBlocks.length && recentBlocks[0].height
|
||||||
const date = (new Date()).toJSON().split('T')[0]
|
const date = (new Date()).toJSON().split('T')[0]
|
||||||
const data = { date, meta }
|
const data = { date, block, meta }
|
||||||
|
|
||||||
writeFileSync(dst, JSON.stringify(data, null, 2))
|
writeFileSync(dst, JSON.stringify(data, null, 2))
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
const compress_images = require('compress-images')
|
|
||||||
const input = 'compress/*.{jpg,png,svg,gif}'
|
|
||||||
const output = 'compress/out/'
|
|
||||||
|
|
||||||
compress_images(input, output, { compress_force: true, statistic: true, autoupdate: false }, false,
|
|
||||||
{ jpg: { engine: "mozjpeg", command: ["-quality", "60"] } },
|
|
||||||
{ png: { engine: "pngquant", command: ["--quality=20-50", "-o"] } },
|
|
||||||
{ svg: { engine: "svgo", command: "--multipass" } },
|
|
||||||
{ gif: { engine: "gifsicle", command: ["--colors", "64", "--use-col=web"] } },
|
|
||||||
(error, completed, statistic) => {
|
|
||||||
if (error) console.error(error)
|
|
||||||
if (statistic) console.log(statistic)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user