docs: 添加 Windows 交叉编译脚本和 Gitea Actions 配置指南
Some checks failed
Release Build / Build Windows (push) Failing after 3m18s
Release Build / Build Linux (push) Failing after 33s
Release Build / Build macOS (push) Has been cancelled

- scripts/build-windows.sh: Windows 交叉编译脚本
- docs/GITEA_ACTIONS.md: Gitea Actions Runner 配置指南

使用方式:
1. 配置 Gitea Actions Runner (参考 docs/GITEA_ACTIONS.md)
2. 或手动运行 ./scripts/build-windows.sh --upload
This commit is contained in:
大麦
2026-03-10 16:10:51 +08:00
parent 3a6f2f29cd
commit 5c3e7ccbfd
2 changed files with 308 additions and 0 deletions

149
docs/GITEA_ACTIONS.md Normal file
View File

@@ -0,0 +1,149 @@
# Gitea Actions Runner 配置指南
## 概述
Gitea Actions 是 Gitea 的 CI/CD 系统,与 GitHub Actions 兼容。
## 配置步骤
### 1. 启用 Gitea Actions
编辑 Gitea 配置文件 (`/etc/gitea/app.ini``~/.gitea/conf/app.ini`):
```ini
[actions]
ENABLED = true
DEFAULT_ACTIONS_URL = github
```
重启 Gitea:
```bash
sudo systemctl restart gitea
```
### 2. 安装 Runner
#### macOS 安装
```bash
# 下载 Runner
mkdir -p ~/gitea-runner
cd ~/gitea-runner
curl -L https://github.com/actions/runner/releases/latest/download/actions-runner-darwin-x64-2.311.0.tar.gz -o runner.tar.gz
tar xzf runner.tar.gz
# 配置 Runner
./config.sh --url http://192.168.120.110:4000/damai/readflow \
--token <TOKEN_FROM_GITEA> \
--name macos-runner \
--runnergroup default
# 启动 Runner
./run.sh
```
#### Linux 安装
```bash
# 下载 Runner
mkdir -p ~/gitea-runner
cd ~/gitea-runner
curl -L https://github.com/actions/runner/releases/latest/download/actions-runner-linux-x64-2.311.0.tar.gz -o runner.tar.gz
tar xzf runner.tar.gz
# 配置 Runner
./config.sh --url http://192.168.120.110:4000/damai/readflow \
--token <TOKEN_FROM_GITEA> \
--name linux-runner \
--runnergroup default
# 启动 Runner
./run.sh
```
### 3. 获取 Runner Token
1. 访问 Gitea 仓库http://192.168.120.110:4000/damai/readflow
2. 进入 Settings → Actions
3. 点击 "Add runner"
4. 复制 Token
### 4. 验证 Runner
访问 Gitea 仓库的 Actions 页面,应该能看到注册的 Runner。
### 5. 触发编译
推送标签触发编译:
```bash
cd /Users/rong/.openclaw/workspace/readflow
git tag -a v0.2.1 -m "Release v0.2.1"
git push origin v0.2.1
```
---
## 工作流文件
工作流文件位于:`.gitea/workflows/release.yml`
支持的平台:
- ✅ Windows (x86_64-pc-windows-gnu)
- ✅ Linux (x86_64-unknown-linux-gnu)
- ✅ macOS (x86_64-apple-darwin)
---
## 故障排除
### Runner 无法连接
检查 Gitea 配置:
```ini
[actions]
ENABLED = true
DEFAULT_ACTIONS_URL = github
```
### 编译失败
检查 Runner 是否安装了必要的依赖:
```bash
# macOS
brew install rust mingw-w64
# Linux
sudo apt-get install rustc mingw-w64
```
### 查看日志
访问 Gitea 仓库的 Actions 页面查看编译日志。
---
## 快速开始
### 方案 1: 使用 Docker Runner (推荐)
```bash
docker run -d \
-e GITEA_INSTANCE_URL=http://192.168.120.110:4000 \
-e GITEA_RUNNER_REGISTRATION_TOKEN=<TOKEN> \
-e GITEA_RUNNER_NAME=docker-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/gitea/act_runner:latest
```
### 方案 2: 本地安装 Runner
参考上面的安装步骤。
---
## 参考资料
- Gitea Actions 文档https://docs.gitea.io/usage/actions/
- Runner 下载https://github.com/actions/runner/releases
- Workflows 语法https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions