From dfdb5929eaab36234ae115eda59b856a827bb55b Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 06:59:58 +0000 Subject: [PATCH 01/34] add codeberg pages deploy --- public/logos/codeberg.svg | 115 ++++++++++++++++++ .../docs/zh-cn/guides/deploy/codeberg.mdx | 88 ++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 public/logos/codeberg.svg create mode 100644 src/content/docs/zh-cn/guides/deploy/codeberg.mdx diff --git a/public/logos/codeberg.svg b/public/logos/codeberg.svg new file mode 100644 index 0000000000000..e7a528d5ac5f3 --- /dev/null +++ b/public/logos/codeberg.svg @@ -0,0 +1,115 @@ + + + Codeberg logo + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Codeberg logo + + + + Robert Martinez + + + + + Codeberg and the Codeberg Logo are trademarks of Codeberg e.V. + + + 2020-04-09 + + + Codeberg e.V. + + + codeberg.org + + + + + + + + + + + + + diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx new file mode 100644 index 0000000000000..4bb26c2ade68a --- /dev/null +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -0,0 +1,88 @@ +--- +title: 部署你的 Astro 站点至 Codeberg Pages +description: 如何使用 Codeberg Pages 将你的 Astro 网站部署到网络上。 +sidebar: + label: Codeberg Pages +type: deploy +--- +import { Steps } from '@astrojs/starlight/components'; + +你可以使用[Codeberg Pages](https://codeberg.page/)直接从[Codeberg](https://codeberg.org)上的存储库托管 Astro 网站。 + +## 如何部署 + +你可以使用 Codeberg CI 来自动构建和部署站点,从而将 Astro 网站部署到 Codeberg Pages。为此,你的源代码必须托管在 Codeberg 上,并进行以下操作: + +1. 在[这里](https://codeberg.org/Codeberg-e.V./requests/issues)提起一个 Issue,标签选择 `ci` ,`Expected Resource Usage` 选 `medium`,`I would also like the following users to be added` 填 `@自己的 Codeberg 用户名`,其他自己看着填,等待审批通过。 + +2. 在仓库根目录中,新建 `.forgejo` 文件夹,在 `.forgejo` 文件夹下再新建 `workflows` 文件夹。 +3. 在文件夹中添加 `astro.yaml` 文件,文件代码示例如下: +``` +name: Deploy Astro site to Pages +on: + push: + branches: + - main # 只在推送到 main 分支时触发 + workflow_dispatch: # 允许手动触发 +jobs: + build: + runs-on: codeberg-tiny-lazy + container: + image: node:20 # 使用 Node.js 20 作为基础镜像 + steps: + - name: 检查 .domains 文件 + run: | + git ls-files public/.domains + ls -la public/ + ls -la public/.domains || echo ".domains not found" + - name: 检出代码 + uses: https://code.forgejo.org/actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: 安装依赖 + run: npm install + - name: 构建 Astro 静态文件 + run: npm run build # 使用 Astro 的构建命令 + - name: 上传构建产物 + uses: https://code.forgejo.org/actions/upload-artifact@v3 + with: + name: Generated files + path: dist/ # Astro 默认输出目录 + include-hidden-files: true + deploy: + needs: [build] # 依赖 build 作业完成 + runs-on: codeberg-tiny-lazy + steps: + - name: 检出代码 + uses: https://code.forgejo.org/actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: 切换到 pages 分支并清理 + run: | + git checkout pages || git switch --orphan pages + rm -Rfv $(ls -A | egrep -v '^(\.git|LICENSE)$') + - name: 下载构建产物 + uses: https://code.forgejo.org/actions/download-artifact@v3 + with: + name: Generated files + - name: 发布网站 + run: | + git config user.email "codeberg-ci@example.com" + git config user.name "Codeberg CI" + echo "=== 正在提交的文件 ===" + ls -la + git add . + git commit --allow-empty -m "Codeberg build for ${GITHUB_SHA}" + git push origin pages + +``` + +4. 在 `public` 目录下新建 `.domains` 文件,输入 `分支.仓库名.用户名.codeberg.page`,这就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 + +5. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 + + + +你的网站现在应该可以发布了!当你将更改推送到 Astro 项目的仓库时,Codeberg CI 流水线将自动为你部署它们。 \ No newline at end of file From e897b75874885f28cdb56ca78c2c55b3d9cc3d0d Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:03:31 +0800 Subject: [PATCH 02/34] Update codeberg.mdx --- .../docs/zh-cn/guides/deploy/codeberg.mdx | 68 +++++++++++-------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 4bb26c2ade68a..0d3b232e3015d 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -15,74 +15,88 @@ import { Steps } from '@astrojs/starlight/components'; 1. 在[这里](https://codeberg.org/Codeberg-e.V./requests/issues)提起一个 Issue,标签选择 `ci` ,`Expected Resource Usage` 选 `medium`,`I would also like the following users to be added` 填 `@自己的 Codeberg 用户名`,其他自己看着填,等待审批通过。 -2. 在仓库根目录中,新建 `.forgejo` 文件夹,在 `.forgejo` 文件夹下再新建 `workflows` 文件夹。 -3. 在文件夹中添加 `astro.yaml` 文件,文件代码示例如下: +2. +3. 在仓库根目录中,新建 `.forgejo` 文件夹,在 `.forgejo` 文件夹下再新建 `workflows` 文件夹。 +4. 在文件夹中添加 `astro.yaml` 文件,文件代码示例如下: ``` name: Deploy Astro site to Pages + on: + # Runs on pushes targeting the default branch push: branches: - - main # 只在推送到 main 分支时触发 - workflow_dispatch: # 允许手动触发 + # 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 - container: - image: node:20 # 使用 Node.js 20 作为基础镜像 steps: - - name: 检查 .domains 文件 + - 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: 检出代码 - uses: https://code.forgejo.org/actions/checkout@v4 + - name: Setup Node.js + uses: https://code.forgejo.org/actions/setup-node@v4 with: - submodules: recursive - fetch-depth: 0 - - name: 安装依赖 + node-version: 22 + - name: Install dependencies run: npm install - - name: 构建 Astro 静态文件 - run: npm run build # 使用 Astro 的构建命令 - - name: 上传构建产物 + - 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/ # Astro 默认输出目录 + path: dist/ include-hidden-files: true + deploy: - needs: [build] # 依赖 build 作业完成 + needs: [ build ] runs-on: codeberg-tiny-lazy steps: - - name: 检出代码 + - name: Clone the repository uses: https://code.forgejo.org/actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - - name: 切换到 pages 分支并清理 + + - 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: 下载构建产物 + + - name: Download generated files uses: https://code.forgejo.org/actions/download-artifact@v3 with: name: Generated files - - name: 发布网站 + + - name: Publish the website run: | - git config user.email "codeberg-ci@example.com" + git config user.email codeberg-ci git config user.name "Codeberg CI" - echo "=== 正在提交的文件 ===" + echo "=== Files being committed ===" ls -la git add . - git commit --allow-empty -m "Codeberg build for ${GITHUB_SHA}" + git commit --allow-empty --message "Codeberg build for ${GITHUB_SHA}" git push origin pages ``` -4. 在 `public` 目录下新建 `.domains` 文件,输入 `分支.仓库名.用户名.codeberg.page`,这就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 +5. 在 `public` 目录下新建 `.domains` 文件,输入 `分支.仓库名.用户名.codeberg.page`,这就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 -5. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 +6. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 -你的网站现在应该可以发布了!当你将更改推送到 Astro 项目的仓库时,Codeberg CI 流水线将自动为你部署它们。 \ No newline at end of file +你的网站现在应该可以发布了!当你将更改推送到 Astro 项目的仓库时,Codeberg CI 流水线将自动为你部署它们。 From 9acecc1bb787cee1f39dac6ae911abc1a4679adf Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:09:04 +0800 Subject: [PATCH 03/34] Update codeberg.mdx --- .../docs/zh-cn/guides/deploy/codeberg.mdx | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 0d3b232e3015d..633fc598fa3c2 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -15,10 +15,41 @@ import { Steps } from '@astrojs/starlight/components'; 1. 在[这里](https://codeberg.org/Codeberg-e.V./requests/issues)提起一个 Issue,标签选择 `ci` ,`Expected Resource Usage` 选 `medium`,`I would also like the following users to be added` 填 `@自己的 Codeberg 用户名`,其他自己看着填,等待审批通过。 -2. +2. 在 `astro.config.mjs` 文件中设置 [`site`](/zh-cn/reference/configuration-reference/#site) 和 [`base`](/zh-cn/reference/configuration-reference/#base)。 +```js title="astro.config.mjs" ins={4-5} +import { defineConfig } from 'astro/config'; + + export default defineConfig({ + site: 'https://.gitlab.io', + base: '/', + outDir: 'public', + publicDir: 'static', + }); +``` + + `base` + + 为了让 Astro 将你的仓库名(例如:`/my-repo`)视为网站的根目录,所以可能需要一个 `base` 的值。 + + :::note + 如果你的页面是由根目录提供的,则不需要设置 `base` 参数。 + ::: + + `base` 的值应该是诸如 `/my-blog` 这样以斜杠开头的仓库名称。这样 Astro 就能理解你网站的根目录是 `/my-repo`,而不是默认的 `/`。 + + :::caution + 配置此值后,所有内部页面链接都必须以你的 `base` 值作为前缀: + + ```astro ins="/my-repo" + 关于 + ``` + + 请参阅 [配置 `base` 的值](/zh-cn/reference/configuration-reference/#base) + ::: + 3. 在仓库根目录中,新建 `.forgejo` 文件夹,在 `.forgejo` 文件夹下再新建 `workflows` 文件夹。 -4. 在文件夹中添加 `astro.yaml` 文件,文件代码示例如下: -``` +4. 在文件夹中添加 `astro.yml` 文件,文件代码示例如下: +```yml name: Deploy Astro site to Pages on: From 14902943ef412cdde6e0e43b6d906b031dd0d3f4 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:10:38 +0800 Subject: [PATCH 04/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 633fc598fa3c2..7b903f2a53a73 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -124,7 +124,7 @@ jobs: ``` -5. 在 `public` 目录下新建 `.domains` 文件,输入 `分支.仓库名.用户名.codeberg.page`,这就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 +5. 在 `public` 目录下新建 `.domains` 文件,输入 `用户名.codeberg.pages`,在前面的域名后面加上`/你的仓库名称`,就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 6. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 From 67db170a824d4a1a8fe3fcc7c05d957037592782 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:11:15 +0800 Subject: [PATCH 05/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 7b903f2a53a73..5adb1b581c70f 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -29,11 +29,7 @@ import { defineConfig } from 'astro/config'; `base` - 为了让 Astro 将你的仓库名(例如:`/my-repo`)视为网站的根目录,所以可能需要一个 `base` 的值。 - - :::note - 如果你的页面是由根目录提供的,则不需要设置 `base` 参数。 - ::: + 为了让 Astro 将你的仓库名(例如:`/my-repo`)视为网站的根目录,所以需要一个 `base` 的值。 `base` 的值应该是诸如 `/my-blog` 这样以斜杠开头的仓库名称。这样 Astro 就能理解你网站的根目录是 `/my-repo`,而不是默认的 `/`。 From 0c46921e6c22c6a270081682218f009bc1d94eaf Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:17:15 +0800 Subject: [PATCH 06/34] Create codeberg.mdx --- .../docs/en/guides/deploy/codeberg.mdx | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 src/content/docs/en/guides/deploy/codeberg.mdx diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx new file mode 100644 index 0000000000000..f33ce6a02d18b --- /dev/null +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -0,0 +1,130 @@ +--- +title: Deploy Your Astro Site to Codeberg Pages +description: How to deploy your Astro website to the web using Codeberg Pages. +sidebar: + label: Codeberg Pages +type: deploy +--- +import { Steps } from '@astrojs/starlight/components'; + +You can host your Astro website using [Codeberg Pages](https://codeberg.page/) directly from your repository on [Codeberg](https://codeberg.org). + +## How to Deploy + +You can deploy your Astro site to Codeberg Pages using Codeberg CI to automatically build and deploy your site. To do this, your source code must be hosted on Codeberg and you need to: + + +1. Create an issue [here](https://codeberg.org/Codeberg-e.V./requests/issues) with the label `ci`, select `medium` for `Expected Resource Usage`, fill in `@your-codeberg-username` in the `I would also like the following users to be added` field, fill in other details as needed, and wait for approval. + +2. Set the [`site`](/zh-cn/reference/configuration-reference/#site) and [`base`](/zh-cn/reference/configuration-reference/#base) options in your `astro.config.mjs` file. +```js title="astro.config.mjs" ins={4-5} +import { defineConfig } from 'astro/config'; + + export default defineConfig({ + site: 'https://.codeberg.page', + base: '/', + outDir: 'dist', + publicDir: 'public', + }); + +`base` + +You need a `base` value so that Astro treats your repository name (e.g., `/my-repo`) as the root directory of your website. + +:::note + If your pages are served from the root directory, you do not need to set the `base` parameter. +::: + +The value of `base` should be your repository name starting with a slash, such as `/my-blog`. This lets Astro understand that the root directory of your website 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" + About + ``` + +See [Configuring the `base` value](/zh-cn/reference/configuration-reference/#base) +::: + +3. In the root directory of your repository, create a new .forgejo folder, then create a workflows folder inside the .forgejo folder. +4. Add an astro.yml file in the folder with the following example code: +```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. Create a .domains file in the public directory and enter `branch.repo-name.username.codeberg.page`, which will be your default domain. If you want to add a custom domain, please check [this article]((https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md). + +Commit your changes and push them to Codeberg. Codeberg will automatically deploy your site for you. + +Your website should now be published! When you push changes to your Astro project's repository, the Codeberg CI pipeline will automatically deploy them for you. From 7366658e986379f37029c25178832ffa7f279552 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:20:47 +0800 Subject: [PATCH 07/34] Delete src/content/docs/en/guides/deploy/codeberg.mdx --- .../docs/en/guides/deploy/codeberg.mdx | 130 ------------------ 1 file changed, 130 deletions(-) delete mode 100644 src/content/docs/en/guides/deploy/codeberg.mdx diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx deleted file mode 100644 index f33ce6a02d18b..0000000000000 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: Deploy Your Astro Site to Codeberg Pages -description: How to deploy your Astro website to the web using Codeberg Pages. -sidebar: - label: Codeberg Pages -type: deploy ---- -import { Steps } from '@astrojs/starlight/components'; - -You can host your Astro website using [Codeberg Pages](https://codeberg.page/) directly from your repository on [Codeberg](https://codeberg.org). - -## How to Deploy - -You can deploy your Astro site to Codeberg Pages using Codeberg CI to automatically build and deploy your site. To do this, your source code must be hosted on Codeberg and you need to: - - -1. Create an issue [here](https://codeberg.org/Codeberg-e.V./requests/issues) with the label `ci`, select `medium` for `Expected Resource Usage`, fill in `@your-codeberg-username` in the `I would also like the following users to be added` field, fill in other details as needed, and wait for approval. - -2. Set the [`site`](/zh-cn/reference/configuration-reference/#site) and [`base`](/zh-cn/reference/configuration-reference/#base) options in your `astro.config.mjs` file. -```js title="astro.config.mjs" ins={4-5} -import { defineConfig } from 'astro/config'; - - export default defineConfig({ - site: 'https://.codeberg.page', - base: '/', - outDir: 'dist', - publicDir: 'public', - }); - -`base` - -You need a `base` value so that Astro treats your repository name (e.g., `/my-repo`) as the root directory of your website. - -:::note - If your pages are served from the root directory, you do not need to set the `base` parameter. -::: - -The value of `base` should be your repository name starting with a slash, such as `/my-blog`. This lets Astro understand that the root directory of your website 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" - About - ``` - -See [Configuring the `base` value](/zh-cn/reference/configuration-reference/#base) -::: - -3. In the root directory of your repository, create a new .forgejo folder, then create a workflows folder inside the .forgejo folder. -4. Add an astro.yml file in the folder with the following example code: -```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. Create a .domains file in the public directory and enter `branch.repo-name.username.codeberg.page`, which will be your default domain. If you want to add a custom domain, please check [this article]((https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md). - -Commit your changes and push them to Codeberg. Codeberg will automatically deploy your site for you. - -Your website should now be published! When you push changes to your Astro project's repository, the Codeberg CI pipeline will automatically deploy them for you. From dcb8606a5277263733591972a11154e0bd0ac2f2 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:21:34 +0800 Subject: [PATCH 08/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 5adb1b581c70f..49bb6c0d11653 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -20,10 +20,10 @@ import { Steps } from '@astrojs/starlight/components'; import { defineConfig } from 'astro/config'; export default defineConfig({ - site: 'https://.gitlab.io', + site: 'https://.codeberg.page', base: '/', - outDir: 'public', - publicDir: 'static', + outDir: 'dist', + publicDir: 'public', }); ``` From bc57bccc82508832ae866cbbf9faf6d0c8ad6c6b Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:29:47 +0800 Subject: [PATCH 09/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 49bb6c0d11653..d26db4bb8c022 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -123,7 +123,6 @@ jobs: 5. 在 `public` 目录下新建 `.domains` 文件,输入 `用户名.codeberg.pages`,在前面的域名后面加上`/你的仓库名称`,就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 6. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 - 你的网站现在应该可以发布了!当你将更改推送到 Astro 项目的仓库时,Codeberg CI 流水线将自动为你部署它们。 From 1019f8de3878294b10d85fdc9fcaffa59c13c555 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:31:47 +0800 Subject: [PATCH 10/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index d26db4bb8c022..49bb6c0d11653 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -123,6 +123,7 @@ jobs: 5. 在 `public` 目录下新建 `.domains` 文件,输入 `用户名.codeberg.pages`,在前面的域名后面加上`/你的仓库名称`,就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 6. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 + 你的网站现在应该可以发布了!当你将更改推送到 Astro 项目的仓库时,Codeberg CI 流水线将自动为你部署它们。 From fb3c123be91288711898ff723491f71839e186f4 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:39:41 +0800 Subject: [PATCH 11/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 49bb6c0d11653..1f063b639d60a 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -124,6 +124,6 @@ jobs: 6. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 - + 你的网站现在应该可以发布了!当你将更改推送到 Astro 项目的仓库时,Codeberg CI 流水线将自动为你部署它们。 From 71f9f2dcff585ebaefc4f978b7afc96d6608e2d0 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:44:23 +0800 Subject: [PATCH 12/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 1f063b639d60a..97a41dc742973 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -6,19 +6,14 @@ sidebar: type: deploy --- import { Steps } from '@astrojs/starlight/components'; - 你可以使用[Codeberg Pages](https://codeberg.page/)直接从[Codeberg](https://codeberg.org)上的存储库托管 Astro 网站。 - ## 如何部署 - 你可以使用 Codeberg CI 来自动构建和部署站点,从而将 Astro 网站部署到 Codeberg Pages。为此,你的源代码必须托管在 Codeberg 上,并进行以下操作: 1. 在[这里](https://codeberg.org/Codeberg-e.V./requests/issues)提起一个 Issue,标签选择 `ci` ,`Expected Resource Usage` 选 `medium`,`I would also like the following users to be added` 填 `@自己的 Codeberg 用户名`,其他自己看着填,等待审批通过。 - 2. 在 `astro.config.mjs` 文件中设置 [`site`](/zh-cn/reference/configuration-reference/#site) 和 [`base`](/zh-cn/reference/configuration-reference/#base)。 ```js title="astro.config.mjs" ins={4-5} import { defineConfig } from 'astro/config'; - export default defineConfig({ site: 'https://.codeberg.page', base: '/', @@ -26,23 +21,17 @@ import { defineConfig } from 'astro/config'; publicDir: 'public', }); ``` - `base` 为了让 Astro 将你的仓库名(例如:`/my-repo`)视为网站的根目录,所以需要一个 `base` 的值。 - `base` 的值应该是诸如 `/my-blog` 这样以斜杠开头的仓库名称。这样 Astro 就能理解你网站的根目录是 `/my-repo`,而不是默认的 `/`。 - :::caution 配置此值后,所有内部页面链接都必须以你的 `base` 值作为前缀: - ```astro ins="/my-repo" 关于 ``` - 请参阅 [配置 `base` 的值](/zh-cn/reference/configuration-reference/#base) ::: - 3. 在仓库根目录中,新建 `.forgejo` 文件夹,在 `.forgejo` 文件夹下再新建 `workflows` 文件夹。 4. 在文件夹中添加 `astro.yml` 文件,文件代码示例如下: ```yml @@ -119,11 +108,7 @@ jobs: git push origin pages ``` - 5. 在 `public` 目录下新建 `.domains` 文件,输入 `用户名.codeberg.pages`,在前面的域名后面加上`/你的仓库名称`,就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 - 6. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 - - 你的网站现在应该可以发布了!当你将更改推送到 Astro 项目的仓库时,Codeberg CI 流水线将自动为你部署它们。 From 7bfe068a589a498517f7052c859a18b2dce5ad3b Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 19:52:35 +0800 Subject: [PATCH 13/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 97a41dc742973..d1695205e0533 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -5,7 +5,7 @@ sidebar: label: Codeberg Pages type: deploy --- -import { Steps } from '@astrojs/starlight/components'; +import Steps from '@astrojs/starlight/components'; 你可以使用[Codeberg Pages](https://codeberg.page/)直接从[Codeberg](https://codeberg.org)上的存储库托管 Astro 网站。 ## 如何部署 你可以使用 Codeberg CI 来自动构建和部署站点,从而将 Astro 网站部署到 Codeberg Pages。为此,你的源代码必须托管在 Codeberg 上,并进行以下操作: From 8d61ff2853143b0cc7110bed0d2d756662c1769d Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:07:03 +0800 Subject: [PATCH 14/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index d1695205e0533..234143bb8a934 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -5,7 +5,7 @@ sidebar: label: Codeberg Pages type: deploy --- -import Steps from '@astrojs/starlight/components'; +import {Steps} from '@astrojs/starlight/components'; 你可以使用[Codeberg Pages](https://codeberg.page/)直接从[Codeberg](https://codeberg.org)上的存储库托管 Astro 网站。 ## 如何部署 你可以使用 Codeberg CI 来自动构建和部署站点,从而将 Astro 网站部署到 Codeberg Pages。为此,你的源代码必须托管在 Codeberg 上,并进行以下操作: From 64cae202548f102e118339ffa339d37450bc7927 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:10:54 +0800 Subject: [PATCH 15/34] Create codeberg.mdx --- .../docs/en/guides/deploy/codeberg.mdx | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 src/content/docs/en/guides/deploy/codeberg.mdx diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx new file mode 100644 index 0000000000000..c079cc027fc57 --- /dev/null +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -0,0 +1,121 @@ +Here's the translation into English: + +--- +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: + +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://.codeberg.page', + base: '/', + outDir: 'dist', + publicDir: 'public', + }); +`base` +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" + About + ``` +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: +``` +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. + + + +Your site should now be publishable! When you push updates to your Astro project's repository, the Codeberg CI pipeline will automatically deploy them. From 1cd68a8cc9ee2a2bce32d54f2520fb9d430d67b1 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:13:19 +0800 Subject: [PATCH 16/34] Update codeberg.mdx --- src/content/docs/en/guides/deploy/codeberg.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index c079cc027fc57..e5f22fb2af5a2 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -1,5 +1,3 @@ -Here's the translation into English: - --- title: Deploy Your Astro Site to Codeberg Pages description: How to use Codeberg Pages to deploy your Astro site to the web. From d3ef1b6b3ebf8e030eba4d7c2117203258bed8dd Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:16:14 +0800 Subject: [PATCH 17/34] Update codeberg.mdx --- src/content/docs/en/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index e5f22fb2af5a2..5596174e9fc65 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -2,7 +2,7 @@ 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 + label: Codeberg Pages type: deploy --- import { Steps } from '@astrojs/starlight/components'; From 4ebd047c0093016a7e2c37dd8336364351c42f80 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:20:21 +0800 Subject: [PATCH 18/34] Update codeberg.mdx From f6aac18044830bfe08cceae7022a079e1a61f4b8 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:27:27 +0800 Subject: [PATCH 19/34] Update codeberg.mdx --- src/content/docs/en/guides/deploy/codeberg.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index 5596174e9fc65..d4d63bcb40b3e 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -5,7 +5,9 @@ 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: From 887e2df9911a461c4388a99b90f8eab980cbd0c0 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:27:56 +0800 Subject: [PATCH 20/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 234143bb8a934..061594b72a5a7 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -5,7 +5,9 @@ sidebar: label: Codeberg Pages type: deploy --- + import {Steps} from '@astrojs/starlight/components'; + 你可以使用[Codeberg Pages](https://codeberg.page/)直接从[Codeberg](https://codeberg.org)上的存储库托管 Astro 网站。 ## 如何部署 你可以使用 Codeberg CI 来自动构建和部署站点,从而将 Astro 网站部署到 Codeberg Pages。为此,你的源代码必须托管在 Codeberg 上,并进行以下操作: From 03a64421ef5136c80f0c76f14f68622243423cc9 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:32:11 +0800 Subject: [PATCH 21/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 061594b72a5a7..72104092b1275 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -6,7 +6,7 @@ sidebar: type: deploy --- -import {Steps} from '@astrojs/starlight/components'; +import { Steps } from '@astrojs/starlight/components'; 你可以使用[Codeberg Pages](https://codeberg.page/)直接从[Codeberg](https://codeberg.org)上的存储库托管 Astro 网站。 ## 如何部署 From 1e9265b975bd3a35fd97e5e5357fc0db761bfdb4 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:35:41 +0800 Subject: [PATCH 22/34] Update codeberg.mdx --- src/content/docs/zh-cn/guides/deploy/codeberg.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx index 72104092b1275..423ad89a7e6ea 100644 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx @@ -7,7 +7,6 @@ type: deploy --- import { Steps } from '@astrojs/starlight/components'; - 你可以使用[Codeberg Pages](https://codeberg.page/)直接从[Codeberg](https://codeberg.org)上的存储库托管 Astro 网站。 ## 如何部署 你可以使用 Codeberg CI 来自动构建和部署站点,从而将 Astro 网站部署到 Codeberg Pages。为此,你的源代码必须托管在 Codeberg 上,并进行以下操作: From 9d05d8f566d33e794c3c6831f88d29ddafeaa841 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 20:51:26 +0800 Subject: [PATCH 23/34] Delete src/content/docs/zh-cn/guides/deploy/codeberg.mdx --- .../docs/zh-cn/guides/deploy/codeberg.mdx | 115 ------------------ 1 file changed, 115 deletions(-) delete mode 100644 src/content/docs/zh-cn/guides/deploy/codeberg.mdx diff --git a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx b/src/content/docs/zh-cn/guides/deploy/codeberg.mdx deleted file mode 100644 index 423ad89a7e6ea..0000000000000 --- a/src/content/docs/zh-cn/guides/deploy/codeberg.mdx +++ /dev/null @@ -1,115 +0,0 @@ ---- -title: 部署你的 Astro 站点至 Codeberg Pages -description: 如何使用 Codeberg Pages 将你的 Astro 网站部署到网络上。 -sidebar: - label: Codeberg Pages -type: deploy ---- - -import { Steps } from '@astrojs/starlight/components'; -你可以使用[Codeberg Pages](https://codeberg.page/)直接从[Codeberg](https://codeberg.org)上的存储库托管 Astro 网站。 -## 如何部署 -你可以使用 Codeberg CI 来自动构建和部署站点,从而将 Astro 网站部署到 Codeberg Pages。为此,你的源代码必须托管在 Codeberg 上,并进行以下操作: - -1. 在[这里](https://codeberg.org/Codeberg-e.V./requests/issues)提起一个 Issue,标签选择 `ci` ,`Expected Resource Usage` 选 `medium`,`I would also like the following users to be added` 填 `@自己的 Codeberg 用户名`,其他自己看着填,等待审批通过。 -2. 在 `astro.config.mjs` 文件中设置 [`site`](/zh-cn/reference/configuration-reference/#site) 和 [`base`](/zh-cn/reference/configuration-reference/#base)。 -```js title="astro.config.mjs" ins={4-5} -import { defineConfig } from 'astro/config'; - export default defineConfig({ - site: 'https://.codeberg.page', - base: '/', - outDir: 'dist', - publicDir: 'public', - }); -``` - `base` - - 为了让 Astro 将你的仓库名(例如:`/my-repo`)视为网站的根目录,所以需要一个 `base` 的值。 - `base` 的值应该是诸如 `/my-blog` 这样以斜杠开头的仓库名称。这样 Astro 就能理解你网站的根目录是 `/my-repo`,而不是默认的 `/`。 - :::caution - 配置此值后,所有内部页面链接都必须以你的 `base` 值作为前缀: - ```astro ins="/my-repo" - 关于 - ``` - 请参阅 [配置 `base` 的值](/zh-cn/reference/configuration-reference/#base) - ::: -3. 在仓库根目录中,新建 `.forgejo` 文件夹,在 `.forgejo` 文件夹下再新建 `workflows` 文件夹。 -4. 在文件夹中添加 `astro.yml` 文件,文件代码示例如下: -```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. 在 `public` 目录下新建 `.domains` 文件,输入 `用户名.codeberg.pages`,在前面的域名后面加上`/你的仓库名称`,就是你的默认域名。如果要添加自定义域名,请查看[这篇文章](https://codeberg.org/Codeberg/pages-server/src/branch/main/README.md)。 -6. 提交你的更改并将其推送到 Codeberg ,Codeberg 会为你自动部署 。 - -你的网站现在应该可以发布了!当你将更改推送到 Astro 项目的仓库时,Codeberg CI 流水线将自动为你部署它们。 From eee5c08de8b2ba099efbd37f5779e150a0ea4548 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 21:02:01 +0800 Subject: [PATCH 24/34] Update logos.ts --- src/data/logos.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/data/logos.ts b/src/data/logos.ts index 49fd3a836445a..bbd61e4e5a15c 100644 --- a/src/data/logos.ts +++ b/src/data/logos.ts @@ -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' }, From 37089df4edd881e0ae235fcd6178d985e4373573 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 21:06:50 +0800 Subject: [PATCH 25/34] Update codeberg.mdx --- src/content/docs/en/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index d4d63bcb40b3e..d8435e4f73354 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -37,7 +37,7 @@ 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: From d1685a1cac1832b7734561af9670ead6c9d9f3fe Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 21:15:24 +0800 Subject: [PATCH 26/34] Update codeberg.mdx --- .../docs/en/guides/deploy/codeberg.mdx | 88 +++++++++++-------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index d8435e4f73354..efb9d8ccd42d0 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -6,11 +6,14 @@ sidebar: type: deploy --- -import { Steps } from '@astrojs/starlight/components'; +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: + 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. @@ -41,74 +44,84 @@ See [Configuring the `base` value](/en/reference/configuration-reference/#base) 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 + 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" + 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 + uses: https://code.forgejo.org/actions/setup-node@v4 + with: + node-version: 22 - name: Install dependencies -run: npm install + run: npm install - name: Build Astro site -run: npm run build + 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 + 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 + 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)$') + 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 + 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 + 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 ``` @@ -119,3 +132,4 @@ git push origin pages Your site should now be publishable! When you push updates to your Astro project's repository, the Codeberg CI pipeline will automatically deploy them. +``` From 9bace241ec63e93e257f6670b87cb1f2091d30ce Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 21:15:51 +0800 Subject: [PATCH 27/34] Update codeberg.mdx --- src/content/docs/en/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index efb9d8ccd42d0..aaa2d4b20eca8 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -132,4 +132,4 @@ 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. -``` + From d841ca091f0e9803396f9ee158b1a10ee5b40015 Mon Sep 17 00:00:00 2001 From: Wolffyhtl Date: Sat, 15 Nov 2025 21:16:10 +0800 Subject: [PATCH 28/34] Update codeberg.mdx --- .../docs/en/guides/deploy/codeberg.mdx | 88 ++++++++----------- 1 file changed, 37 insertions(+), 51 deletions(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index aaa2d4b20eca8..d8435e4f73354 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -6,14 +6,11 @@ sidebar: type: deploy --- -import { Steps } from "@astrojs/starlight/components"; +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: - 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. @@ -44,84 +41,74 @@ See [Configuring the `base` value](/en/reference/configuration-reference/#base) 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 +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" +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 +uses: https://code.forgejo.org/actions/setup-node@v4 +with: +node-version: 22 - name: Install dependencies - run: npm install +run: npm install - name: Build Astro site - run: npm run build +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 +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 +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)$') +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 +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 +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 ``` @@ -132,4 +119,3 @@ 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. - From 891d2dc5f424dcf479b2c65bb56cec45c11afd1d Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Mon, 17 Nov 2025 08:31:53 -0400 Subject: [PATCH 29/34] Update DeployGuidesNav.astro --- src/components/DeployGuidesNav.astro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/DeployGuidesNav.astro b/src/components/DeployGuidesNav.astro index cd0c0939bcb2c..a2757af22923f 100644 --- a/src/components/DeployGuidesNav.astro +++ b/src/components/DeployGuidesNav.astro @@ -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'] }, ]; --- From d4558f6ee995dcfdfabf0d1e5a2abc78b28e70a4 Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Mon, 17 Nov 2025 11:14:46 -0400 Subject: [PATCH 30/34] Removed the steps component to make sure it builds without first --- src/content/docs/en/guides/deploy/codeberg.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index d8435e4f73354..cfd5f5c84a670 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -11,7 +11,7 @@ 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: - + 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} @@ -116,6 +116,4 @@ git push origin pages 6. Commit your changes and push to Codeberg. Codeberg will deploy automatically for you. - - Your site should now be publishable! When you push updates to your Astro project's repository, the Codeberg CI pipeline will automatically deploy them. From c5973c553fb53f7c12ed52052ea8243228388f94 Mon Sep 17 00:00:00 2001 From: sarahrainsberger Date: Mon, 17 Nov 2025 15:44:56 +0000 Subject: [PATCH 31/34] fix issues with Steps component --- .../docs/en/guides/deploy/codeberg.mdx | 202 ++++++++++-------- 1 file changed, 108 insertions(+), 94 deletions(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index cfd5f5c84a670..dc73f4c7fab23 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -9,111 +9,125 @@ 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: + + 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://.codeberg.page', - base: '/', - outDir: 'dist', - publicDir: 'public', - }); -`base` -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 + + ```js title="astro.config.mjs" ins={4-5} + import { defineConfig } from 'astro/config'; + export default defineConfig({ + site: 'https://.codeberg.page', + base: '/', + 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" - About - ``` -See [Configuring the `base` value](/en/reference/configuration-reference/#base) -::: + ```astro ins="/my-repo" + About + ``` + + 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 - -``` + ```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. + + Your site should now be publishable! When you push updates to your Astro project's repository, the Codeberg CI pipeline will automatically deploy them. From 4a7f68c90cb1050c5d3d4da655ac8d4e37c0858f Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:53:10 -0400 Subject: [PATCH 32/34] Discard changes to Nav component because implementation has changed --- src/components/DeployGuidesNav.astro | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/DeployGuidesNav.astro b/src/components/DeployGuidesNav.astro index a2757af22923f..cd0c0939bcb2c 100644 --- a/src/components/DeployGuidesNav.astro +++ b/src/components/DeployGuidesNav.astro @@ -49,7 +49,6 @@ 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'] }, ]; --- From 4a649311a6440dbd4b23c755b197c2a535c900cb Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:54:02 -0400 Subject: [PATCH 33/34] update frontmatter for new required properties --- src/content/docs/en/guides/deploy/codeberg.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index dc73f4c7fab23..7c01e9d43003b 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -4,6 +4,9 @@ description: How to use Codeberg Pages to deploy your Astro site to the web. sidebar: label: Codeberg Pages type: deploy +logo: codeberg +supports: ['static'] +i18n: true --- import { Steps } from '@astrojs/starlight/components'; From ecec19feed41c050552e28c8e647055bf9cf4d5e Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:58:48 -0400 Subject: [PATCH 34/34] fix typo in i18nReady property --- src/content/docs/en/guides/deploy/codeberg.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/deploy/codeberg.mdx b/src/content/docs/en/guides/deploy/codeberg.mdx index 7c01e9d43003b..b38be6ce746f2 100644 --- a/src/content/docs/en/guides/deploy/codeberg.mdx +++ b/src/content/docs/en/guides/deploy/codeberg.mdx @@ -6,7 +6,7 @@ sidebar: type: deploy logo: codeberg supports: ['static'] -i18n: true +i18nReady: true --- import { Steps } from '@astrojs/starlight/components';