go ver #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: github-pages | |
# inspired by https://blog.oldweb2.com/remix-static-site | |
on: | |
push: | |
branches: [main] | |
#schedule: | |
# - cron: "42 * * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.x" | |
- run: go install golang.org/x/tools/cmd/present | |
- run: go install ./cmd/reveal | |
- name: convert .reveal.md files | |
run: reveal presentations/*/*.reveal.md | |
- name: start server and mirror it with wget | |
run: | | |
go run golang.org/x/tools/cmd/present -http=127.0.0.1:3999 -play=false -orighost=gnolang.github.io & | |
sleep 5 | |
wget --mirror http://localhost:3999 -P workshops --no-host-directories --page-requisites --adjust-extension --convert-links | |
# hacks: wget is missing styles.css (injected in JS) | |
wget --mirror http://localhost:3999/static/styles.css -P workshops --no-host-directories --page-requisites --adjust-extension --convert-links | |
# hacks: copy over the images | |
# (at time of writing, they come from rendered markdown files, which wget can't follow) | |
for i in presentations/*/*.{png,jpg,jpeg}; do cp $i workshops/$i; done || true | |
sed -i='' s@/static/@/workshops/static/@ workshops/static/slides.js | |
- run: find workshops/ -type f -ls | |
- uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./workshops |