Moving from Github Pages to Codeberg Pages
In my quest to slowly move away from Github one big hurdle is still remaining: Moving the sites I currently host on Github Pages to Codeberg Pages.
Here is the step by step guide that worked for me (custom domain)
- Move the repository to Codeberg (I am using my own
migrate-github-to-codeberg/) - Do not forget to set the new remote if you still have a local git repository
git remote set-url origin git@codeberg.org:YOUR_USERNAME/YOUR_REPO.git - Enable Codeberg Actions in
Settings→Units→Enable Actions1 - For the custom domain add the following DNS record:
_git-pages-forge-allowlist.www.example.org TXT https://codeberg.org/username/repository.git2 - Add a
.forgejo/workflows/publish.yamlfile with content roughly like this:
name: Publish
on:
push:
branches: [main]
jobs:
publish:
runs-on: codeberg-small
steps:
- uses: actions/checkout@v6
- name: Install Rust, WASM-Pack and build WASM
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
chmod +x build_all_wasm.sh && ./build_all_wasm.sh
- name: Setup Node
uses: https://code.forgejo.org/actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Build site
run: npm run build
- uses: https://codeberg.org/git-pages/action@v2
with:
site: https://notes.simonschlegl.com/
server: codeberg.page
token: ${{ forgejo.token }}
source: dist/
For me somehow codeberg-tiny was not available (?) so I went with codeberg-small
- Route the DNS to codeberg pages:
CNAME codeberg.page.3 - (optional) Check via
dig notes.simonschlegl.comthat it actually points to codeberg.page. - Donate to Codeberg: https://donate.codeberg.org/