视频加载失败

如何将你的Fuwari博客部署到Codeberg Pages (Forgejo Actions版)

371 字
2 分钟
如何将你的Fuwari博客部署到Codeberg Pages (Forgejo Actions版)

Codeberg Pages 是 Codeberg 官方提供的一个静态网站托管平台,类似于 Github Pages.

今天我们就要将Fuwari博客部署到Codeberg Pages , 使用 Forgejo Actions。

首先,在仓库中点击设置,点击仓库功能 / 概览,打开 Actions,保存设置。

接下来,回到仓库,在仓库根目录新建.forgejo/workflows文件夹.

在文件夹中添加 astro.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-medium-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 pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Setup Node.js
uses: https://code.forgejo.org/actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: |
pnpm install
pnpm install @astrojs/sitemap
- name: Build Astro site
run: pnpm 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

然后,就可以愉快的在Codeberg Pages上部署Fuwari博客了!

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或打赏支持!

打赏
如何将你的Fuwari博客部署到Codeberg Pages (Forgejo Actions版)
https://clina.top/posts/fuwari-codeberg-pages/
作者
ClinaSaMa
发布于
2025-12-28
许可协议
CC BY-SA 4.0

评论区

Profile Image of the Author
ClinaSaMa
¡El pueblo unido jamás será vencido!
公告
欢迎来到我的博客!这是一则示例公告。
分类
标签
最新动态
站点统计
文章
26
分类
8
标签
31
总字数
24,597
运行时长
0 天
最后活动
0 天前
站点信息
构建平台
GitHub Actions
博客版本
Firefly v6.16.8
文章许可
CC BY-SA 4.0

当前页面没有目录

文章目录

当前页面没有目录