Lukasz Boryn c12604ebb4 feat(template): publish the Mithlond self-hosted Gitea template
A spare-machine Gitea forge, hardened, backed up and with CI, as a template.
Personal values are placeholders listed in the README.
2026-10-16 15:04:18 +02:00

45 lines
1.4 KiB
YAML

# Draws the contribution heatmap as a snake game and publishes the SVGs to
# the orphan `output` branch, which README.md embeds. Runs on the mithlond
# runner (OKF/guides/12).
name: snake
on:
schedule:
# Daily, clear of the 03:30 backup window when Gitea is stopped.
- cron: "0 5 * * *"
workflow_dispatch:
push:
branches: [main]
defaults:
run:
shell: sh
jobs:
generate:
runs-on: alpine
steps:
- name: Generate SVGs from the Gitea heatmap
run: |
host=${GITHUB_SERVER_URL#https://}; host=${host%/}
# Gitea serves the same /api/v1/users/<name>/heatmap as Forgejo.
npx --yes generate-snake-animation@3.5.0 \
--forgejo_user="$host/$GITHUB_REPOSITORY_OWNER" \
--output=dist/snake.svg \
--output='dist/snake-dark.svg?palette=github-dark'
- name: Publish to the output branch
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
apk add --no-cache -q git
host=${GITHUB_SERVER_URL#https://}; host=${host%/}
cd dist
git init -q -b output
git config user.name "snake"
git config user.email "actions@$host"
git add .
git commit -qm "Update snake"
# Single orphan commit, force-pushed: old SVGs do not pile up.
git push -qf "https://x-access-token:$TOKEN@$host/$GITHUB_REPOSITORY.git" output