Compare commits

...

13 commits

5 changed files with 42 additions and 11 deletions

View file

@ -1,4 +1,4 @@
name: Deploy to Neocities name: Deploy to Production
# only run on changes to main # only run on changes to main
on: on:
@ -9,7 +9,7 @@ on:
- main - main
concurrency: # prevent concurrent deploys doing strange things concurrency: # prevent concurrent deploys doing strange things
group: deploy-to-neocities group: deploy-to-prod
cancel-in-progress: true cancel-in-progress: true
# Default to bash # Default to bash
@ -40,9 +40,25 @@ jobs:
run: | run: |
npm i @torchlight-api/torchlight-cli npm i @torchlight-api/torchlight-cli
npx torchlight npx torchlight
- name: Deploy to Neocities - name: Deploy HTML to Neocities
uses: bcomnes/deploy-to-neocities@v1 uses: bcomnes/deploy-to-neocities@v1
with: with:
api_token: ${{ secrets.NEOCITIES_API_TOKEN }} api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
cleanup: true cleanup: true
dist_dir: public dist_dir: public
- name: Connect to Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_API_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_API_CLIENT_SECRET }}
tags: ${{ secrets.TS_TAG }}
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: id_rsa
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Deploy GMI to Agate
run: |
rsync -avz --delete --exclude='*.html' --exclude='*.css' --exclude='*.js' -e ssh public/ deploy@${{ secrets.GMI_HOST }}:${{ secrets.GMI_CONTENT_PATH }}

View file

@ -27,6 +27,7 @@ enableInlineShortcodes = true
[outputFormats.rss] [outputFormats.rss]
mediatype = "application/rss" mediatype = "application/rss"
baseName = "feed" baseName = "feed"
# gemini output
[outputFormats.gemini] [outputFormats.gemini]
mediatype = "text/gemini" mediatype = "text/gemini"
isPlainText = true isPlainText = true

4
gem-build.sh Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# Quick script to serve gemini locally
hugo --environment local -D
agate --content public --hostname localhost

View file

@ -1,7 +1,12 @@
## [runtimeterror $] # [runtimeterror $]
=> /about Adventures in self-hosting and other technological frustrations.
{{ $pages := .Pages -}} {{ $pages := .Pages -}}
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections -}} {{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections -}}
### Posts
{{ range $pages }} {{ range $pages }}
=> {{ .RelPermalink }} [{{ .Date.Format "2006-01-02" }}] {{ .Title }} => {{ .RelPermalink }} {{ .Date.Format "2006-01-02" }} {{ .Title }}
{{- end }} {{- end }}
---
=> https://runtimeterror.dev This site on the big web

View file

@ -1,6 +1,12 @@
=> / 🏡 [runtimeterror $] => / 💻 [runtimeterror $]
# {{ .Title }}{{ $scratch := newScratch }} # {{ .Title }}{{ $scratch := newScratch }}
{{- if .Params.Date }}
{{- $postDate := .Date.Format "2006-01-02" }}
{{- $updateDate := .Lastmod.Format "2006-01-02" }}
{{ $postDate }}{{ if ne $postDate $updateDate }} ~ {{ $updateDate }}{{ end }}
{{- end }}
{{/* The bulk of this regex magic is derived from https://brainbaking.com/post/2021/04/using-hugo-to-launch-a-gemini-capsule/ */}}
{{ $content := .RawContent -}} {{ $content := .RawContent -}}
{{ $content := $content | replaceRE `#### ` "### " -}} {{ $content := $content | replaceRE `#### ` "### " -}}
{{ $content := $content | replaceRE `\n- (.+?)` "\n* $1" -}} {{ $content := $content | replaceRE `\n- (.+?)` "\n* $1" -}}
@ -24,10 +30,9 @@
{{ $content | safeHTML }} {{ $content | safeHTML }}
--- ---
Written by John Bowdre {{ if .Params.Date }} on {{ .Lastmod.Format "2006-01-02" }}.{{ end}}
=> mailto:blog@runtimeterror.dev 📧 Reply via email => mailto:blog@runtimeterror.dev 📧 Reply via email
## Links ## Bibliography
{{ $scratch.Set "ref" (add (len $links) 1) }}{{ range $refs }}{{ $ref := $scratch.Get "ref" }}{{ $url := (printf "%s #%d" . $ref) }} {{ $scratch.Set "ref" (add (len $links) 1) }}{{ range $refs }}{{ $ref := $scratch.Get "ref" }}{{ $url := (printf "%s #%d" . $ref) }}
=> {{ $url | replaceRE `\[(.+?)\]\((.+?)\) #(\d+)` "$2 [$3] $1 ($2)" -}} => {{ $url | replaceRE `\[(.+?)\]\((.+?)\) #(\d+)` "$2 [$3] $1 ($2)" -}}
{{ $scratch.Set "ref" (add $ref 1) }}{{ end}} {{ $scratch.Set "ref" (add $ref 1) }}{{ end}}
@ -38,5 +43,5 @@ Written by John Bowdre {{ if .Params.Date }} on {{ .Lastmod.Format "2006-01-02"
=> {{ replace .RelPermalink "/gemini" "" 1}} {{ .Title }}{{ end }}{{ end }} => {{ replace .RelPermalink "/gemini" "" 1}} {{ .Title }}{{ end }}{{ end }}
--- ---
=> / Back to the Index => / Home
=> https://runtimeterror.dev{{ replace (replace .RelPermalink "/gemini" "" 1) "index.gmi" "" }} View this article on the WWW => https://runtimeterror.dev{{ replace (replace .RelPermalink "/gemini" "" 1) "index.gmi" "" }} This article on the big web