If you know me, you know I’m big on self-hosting things. Up until 4 years ago, I was self-hosting a Nextcloud instance on a raspberry pi 4 (until it crapped out, and moved to an old laptop).
Over the years, I was/am self hosting various other things, like a password manager, ntfy, hoppscotch (the postman clone), gitea, pihole… You get the idea!
Now, I started this blog some time ago (less than two weeks), and I’ve been experimenting on how to optimize the workflow on creating new posts.
I’m hosting the repo on a private gitea installation, and deploying through npm run deploy on my computer (which runs npm run build && node scripts/deploy.js). The flow of npm run deploy is simple:
- Re-generate the site
- Upload to the server
- ???
- Profit
However, I was thinking this could be even faster for me: Write the blog post, git push, and turn off the computer. After all, why not let gitea re-generate the site and upload it?
So, with some help from Qwen 3.6, I deployed an act_runner on docker for gitea, configured it to download node. It took some tries, but I did it.
And this is the first post I “git push origin main”, that automatically appears on my site!
How to do it?
You need to enable actions on your gitea conf/app.ini:
[actions]
ENABLED = true
Here’s the docker compose file:
services:
gitea-runner:
image: gitea/act_runner:latest
container_name: gitea-runner
restart: unless-stopped
environment:
GITEA_INSTANCE_URL: "http://gitea:3000" # Replace with your actual instance url
GITEA_RUNNER_REGISTRATION_TOKEN: "gitea_registration_token" # Go to Site Administration > Actions > Runners > Create new runner and copy the registration token
GITEA_RUNNER_NAME: "ubuntu-latest"
GITEA_RUNNER_LABELS: "ubuntu-latest"
CONFIG_FILE: /config.yaml
volumes:
- gitea_runner_data:/data
- /var/run/docker.sock:/var/run/docker.sock
- /opt/gitea-runner/config.yaml:/config.yaml:ro
networks:
- staticnet
networks:
staticnet:
external: true
volumes:
gitea_runner_data:
And the config.yaml file user in the gitea-runner container:
runner:
fetch_timeout: 5m
fetch_interval: 2s
container:
network: staticnet
valid_volumes:
- "**"
default_run_image: "node:20-bullseye"
host:
workdir_parent: /tmp/act
Create the workflow file:
Inside your repo, create .gitea/workflows/ folder, and create a “deploy.yml” file with the following contents:
name: Deploy
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
container:
image: node:20-bullseye
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run deploy
You have to change things (like npm run deploy) to run the correct commands, commit the file, push to the repo, and you are done!
So exciting! (I know, it’s stupid to be happy about such little things)