Two years ago, I could set up my static blog with minimal technical effort. I was satisfied with the simple setup: GitHub and Pelican maintainers made it easy enough to concentrate on the writing part.
But the world has changed quite a bit in the meantime, I'm more confortable after 2 very technical years at work and I'm more inclined to use European services for my personal data.
That's why I've started to migrate some projects to Codeberg like pixelize and kindle-highlights. The migration process itself was super easy thanks to the tool provided by Codeberg, so I decided to migrate my blog this weekend, too.
The "challenge" for my blog is that I wanted to use the Codeberg Pages, to host my static html pages. I wanted to keep it simple to manage. I knew Codeberg had a similar mechanism as the GitHub Actions, but with some differences.
After some digging about the Forgejo actions and how the runners work there, I succeeded to adapt my GH action to build and deploy my blog. This is a light pipeline, that runs when I push a new article.
Here is the resulting action:
on:
push:
branches:
- master
name: Deploy website to Codeberg Pages
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: codeberg-tiny
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install Python and dependencies
run: |
uv venv --python 3.12
. .venv/bin/activate
uv pip install pelican[markdown] pelican-liquid-tags pelican-sitemap -r requirements.txt
- name: Build Pelican site
run: |
. .venv/bin/activate
pelican content -s publishconf.py -o output
- name: Fix permissions
run: |
chmod -R +rX output
- uses: https://codeberg.org/git-pages/action@v2
with:
site: "https://${{ forge.repository_owner }}.codeberg.page/blog/"
token: ${{ forge.token }}
source: output/
Of course, you need to adapt the branch name: I use master but you might use main instead.
I also use a few Pelican plugins, like liquid-tags and sitemap, so you need to also adapt this line.
Notice the runs-on: codeberg-tiny: this is the way in Codeberg to specify a runner. The documentation explains the characteristics of each runner.
And now my blog runs on frica.codeberg.page/blog ! 🎉
Hope this helps!