Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dfdb592
add codeberg pages deploy
Wolffyhtl Nov 15, 2025
e897b75
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
9acecc1
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
1490294
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
67db170
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
0c46921
Create codeberg.mdx
Wolffyhtl Nov 15, 2025
7366658
Delete src/content/docs/en/guides/deploy/codeberg.mdx
Wolffyhtl Nov 15, 2025
dcb8606
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
bc57bcc
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
1019f8d
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
fb3c123
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
71f9f2d
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
7bfe068
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
8d61ff2
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
64cae20
Create codeberg.mdx
Wolffyhtl Nov 15, 2025
1cd68a8
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
d3ef1b6
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
4ebd047
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
f6aac18
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
887e2df
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
03a6442
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
1e9265b
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
9d05d8f
Delete src/content/docs/zh-cn/guides/deploy/codeberg.mdx
Wolffyhtl Nov 15, 2025
eee5c08
Update logos.ts
Wolffyhtl Nov 15, 2025
37089df
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
d1685a1
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
9bace24
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
d841ca0
Update codeberg.mdx
Wolffyhtl Nov 15, 2025
891d2dc
Update DeployGuidesNav.astro
sarah11918 Nov 17, 2025
f1e6461
Merge branch 'main' into main
sarah11918 Nov 17, 2025
d4558f6
Removed the steps component to make sure it builds without first
sarah11918 Nov 17, 2025
c5973c5
fix issues with Steps component
sarah11918 Nov 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions public/logos/codeberg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/DeployGuidesNav.astro
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const services: Service[] = [
{ title: 'CloudRay', slug: 'cloudray', supports: ['static'] },
{ title: 'Seenode', slug: 'seenode', supports: ['ssr'] },
{ title: 'Zephyr', slug: 'zephyr', supports: ['static'] },
{ title: 'Codeberg Pages', slug: 'codeberg', supports: ['static'] },
];
---

Expand Down
133 changes: 133 additions & 0 deletions src/content/docs/en/guides/deploy/codeberg.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
title: Deploy Your Astro Site to Codeberg Pages
description: How to use Codeberg Pages to deploy your Astro site to the web.
sidebar:
label: Codeberg Pages
type: deploy
---

import { Steps } from '@astrojs/starlight/components';

You can use Codeberg Pages to host your Astro site directly from a repository on Codeberg.

## How to deploy

You can use Codeberg CI to automatically build and deploy your site, publishing your Astro site to Codeberg Pages. For this, your source code must be hosted on Codeberg, and do the following:

<Steps>

1. Open an issue [here](https://codeberg.org/Codeberg-e.V./requests/issues), tag it with `ci`, select `Expected Resource Usage` as `medium`, add your own Codeberg username in `I would also like the following users to be added`, and fill in the rest as you see fit. Wait for approval.

2. Configure the [`site`](/en/reference/configuration-reference/#site) and [`base`](/en/reference/configuration-reference/#base) settings in the `astro.config.mjs` file.

```js title="astro.config.mjs" ins={4-5}
import { defineConfig } from 'astro/config';
export default defineConfig({
site: 'https://<username>.codeberg.page',
base: '/<my-repo>',
outDir: 'dist',
publicDir: 'public',
});
```

To make Astro treat your repository name (e.g., `/my-repo`) as the root directory of your website, you need a `base` value.
:::note
If your pages are served from the root directory, you don't need to set the `base` parameter.
:::

The `base` value should be your repository name starting with a slash, such as `/my-blog`. This lets Astro understand that the root of your site is `/my-repo` instead of the default `/`.

:::caution
After configuring this value, all internal page links must be prefixed with your `base` value:
```astro ins="/my-repo"
<a href="/my-repo/about">About</a>
```

See [Configuring the `base` value](/en/reference/configuration-reference/#base)
:::

3. In the repository root, create a `.forgejo` folder, and inside it create a `workflows` folder.

4. In that folder, add an `astro.yaml` file. A sample of the file is as follows:
```yml
name: Deploy Astro site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
# If you want to build from a different branch, change it here.
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
# You can find the list of available runners on https://codeberg.org/actions/meta, or run one yourself.
runs-on: codeberg-tiny-lazy
steps:
- name: Clone the repository
uses: https://code.forgejo.org/actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: check .domains files
run: |
git ls-files public/.domains
ls -la public/
ls -la public/.domains || echo ".domains not found"
- name: Setup Node.js
uses: https://code.forgejo.org/actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm install
- name: Build Astro site
run: npm run build

- name: Upload generated files
uses: https://code.forgejo.org/actions/upload-artifact@v3
with:
name: Generated files
path: dist/
include-hidden-files: true

deploy:
needs: [ build ]
runs-on: codeberg-tiny-lazy
steps:
- name: Clone the repository
uses: https://code.forgejo.org/actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Checkout the target branch and clean it up
run: |
git checkout pages || git switch --orphan pages
rm -Rfv $(ls -A | egrep -v '^(\.git|LICENSE)$')

- name: Download generated files
uses: https://code.forgejo.org/actions/download-artifact@v3
with:
name: Generated files

- name: Publish the website
run: |
git config user.email codeberg-ci
git config user.name "Codeberg CI"
echo "=== Files being committed ==="
ls -la
git add .
git commit --allow-empty --message "Codeberg build for ${GITHUB_SHA}"
git push origin pages

```

5. In the public directory, create a `.domains` file and enter `branch.repository.username.codeberg.page`—this is your default domain. If you want to add a custom domain, see this article: https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md.

6. Commit your changes and push to Codeberg. Codeberg will deploy automatically for you.

</Steps>

Your site should now be publishable! When you push updates to your Astro project's repository, the Codeberg CI pipeline will automatically deploy them.
1 change: 1 addition & 0 deletions src/data/logos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const logos = LogoCheck({
cloudflare: { file: 'cloudflare-pages.svg', padding: '.1875em' },
cloudinary: { file: 'cloudinary.svg', padding: '.1875em' },
cloudray: { file: 'cloudray.svg', padding: '0' },
codeberg: { file: 'codeberg.svg',padding: '0' },
'craft-cms': { file: 'craft-cms.svg', padding: '.225em' },
'craft-cross-cms': { file: 'craft-cross-cms.svg', padding: '.225em' },
crystallize: { file: 'crystallize.svg', padding: '.1875em' },
Expand Down