docs: 重构命令和技能文档体系,规范化文档格式和内容组织
This commit is contained in:
@@ -20,17 +20,35 @@ Gitea Act Runner 是 Gitea Actions 的 CI/CD 执行器,兼容 GitHub Actions w
|
||||
|
||||
### 执行模式
|
||||
|
||||
| 模式 | 环境 | 适用场景 | Android SDK |
|
||||
|------|------|---------|-------------|
|
||||
| **Host Mode** | Native macOS/Linux | Android/iOS 构建、原生工具链 | macOS ARM64 支持 |
|
||||
| Docker Mode | Linux 容器 | 跨平台构建 | Linux ARM64 不支持 |
|
||||
| 模式 | 环境 | 适用场景 | 平台支持 |
|
||||
|------|------|---------|---------|
|
||||
| **Host Mode** | Native OS(macOS/Linux/Windows) | Android/iOS 构建、原生工具链 | 全平台支持 |
|
||||
| Docker Mode | Linux 容器 | 跨平台构建 | Linux/macOS(不支持 ARM64 Android) |
|
||||
|
||||
**推荐**:macOS ARM64 使用 **Host Mode** 以支持 Android SDK。
|
||||
**推荐**:
|
||||
- **macOS ARM64**: 使用 **Host Mode** 以支持 Android SDK
|
||||
- **Windows**: 使用 **Host Mode**(需在 workflow 中指定 `shell: powershell`)
|
||||
- **Linux**: 两种模式均可,Docker Mode 隔离性更好
|
||||
|
||||
**Windows Host Mode 注意事项**:
|
||||
- Bash 默认不可用,需在 workflow 中指定 shell:
|
||||
```yaml
|
||||
defaults:
|
||||
run:
|
||||
shell: powershell
|
||||
```
|
||||
- 或者安装 Git Bash 并指定:
|
||||
```yaml
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
```
|
||||
|
||||
## Runner 目录结构
|
||||
|
||||
所有 Runner 配置统一管理在:
|
||||
|
||||
### macOS / Linux
|
||||
```
|
||||
~/.config/gitea/runners/
|
||||
├── runner-macbook-pro/ # Runner 1
|
||||
@@ -42,23 +60,123 @@ Gitea Act Runner 是 Gitea Actions 的 CI/CD 执行器,兼容 GitHub Actions w
|
||||
└── ...
|
||||
```
|
||||
|
||||
### Windows
|
||||
```
|
||||
%USERPROFILE%\.config\gitea\runners\
|
||||
├── runner-desktop-pc\ # Runner 1
|
||||
│ ├── .runner # 注册信息(JSON)
|
||||
│ ├── config.yaml # Runner 配置
|
||||
│ ├── cache\ # Cache 目录
|
||||
│ └── workspace\ # 工作目录
|
||||
└── runner-laptop\ # Runner 2
|
||||
└── ...
|
||||
```
|
||||
|
||||
**Windows 用户提示**:
|
||||
- 完整路径示例:`C:\Users\YourUsername\.config\gitea\runners\`
|
||||
- 配置文件使用反斜杠路径:`workdir_parent: "C:\\Users\\YourUsername\\.config\\gitea\\runners\\runner-name\\workspace"`
|
||||
- 或在 YAML 中使用正斜杠(Windows 兼容):`workdir_parent: "C:/Users/YourUsername/.config/gitea/runners/runner-name/workspace"`
|
||||
|
||||
## 前置要求
|
||||
|
||||
### 1. 安装 act_runner
|
||||
|
||||
**macOS**:
|
||||
```bash
|
||||
# 使用 Homebrew(推荐)
|
||||
brew install act_runner
|
||||
|
||||
# 或手动下载
|
||||
# 或手动下载(ARM64)
|
||||
curl -sL https://gitea.com/gitea/act_runner/releases/download/v0.2.13/act_runner-0.2.13-darwin-arm64 \
|
||||
-o /usr/local/bin/act_runner
|
||||
chmod +x /usr/local/bin/act_runner
|
||||
|
||||
# 或手动下载(x64)
|
||||
curl -sL https://gitea.com/gitea/act_runner/releases/download/v0.2.13/act_runner-0.2.13-darwin-amd64 \
|
||||
-o /usr/local/bin/act_runner
|
||||
chmod +x /usr/local/bin/act_runner
|
||||
|
||||
# 验证安装
|
||||
act_runner --version
|
||||
```
|
||||
|
||||
**Linux**:
|
||||
```bash
|
||||
# 手动下载(x64)
|
||||
curl -sL https://gitea.com/gitea/act_runner/releases/download/v0.2.13/act_runner-0.2.13-linux-amd64 \
|
||||
-o /usr/local/bin/act_runner
|
||||
chmod +x /usr/local/bin/act_runner
|
||||
|
||||
# 或(ARM64)
|
||||
curl -sL https://gitea.com/gitea/act_runner/releases/download/v0.2.13/act_runner-0.2.13-linux-arm64 \
|
||||
-o /usr/local/bin/act_runner
|
||||
chmod +x /usr/local/bin/act_runner
|
||||
|
||||
# 验证安装
|
||||
act_runner --version
|
||||
```
|
||||
|
||||
**Windows**:
|
||||
|
||||
**方法 1: 使用 Scoop(推荐)**
|
||||
```powershell
|
||||
# 安装 Scoop(如果尚未安装)
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
|
||||
|
||||
# 添加 extras bucket
|
||||
scoop bucket add extras
|
||||
|
||||
# 安装 act_runner(如果 Scoop 仓库中有)
|
||||
# 注意:截至目前可能需要手动下载
|
||||
|
||||
# 验证安装
|
||||
act_runner --version
|
||||
```
|
||||
|
||||
**方法 2: 手动下载(推荐)**
|
||||
```powershell
|
||||
# 下载最新版本(x64)
|
||||
$version = "v0.2.13"
|
||||
$arch = "amd64"
|
||||
$url = "https://gitea.com/gitea/act_runner/releases/download/$version/act_runner-$version-windows-$arch.exe"
|
||||
|
||||
# 创建安装目录
|
||||
New-Item -Path "$env:USERPROFILE\bin" -ItemType Directory -Force
|
||||
|
||||
# 下载
|
||||
Invoke-WebRequest -Uri $url -OutFile "$env:USERPROFILE\bin\act_runner.exe"
|
||||
|
||||
# 添加到 PATH(永久)
|
||||
[Environment]::SetEnvironmentVariable(
|
||||
"Path",
|
||||
[Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\bin",
|
||||
"User"
|
||||
)
|
||||
|
||||
# 刷新当前会话的 PATH
|
||||
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
||||
|
||||
# 验证安装
|
||||
act_runner --version
|
||||
```
|
||||
|
||||
**方法 3: 使用 Chocolatey**
|
||||
```powershell
|
||||
# 安装 Chocolatey(如果尚未安装)
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||
|
||||
# 注意:act_runner 可能尚未在 Chocolatey 仓库中,需要手动下载
|
||||
```
|
||||
|
||||
**通用验证**:
|
||||
```bash
|
||||
# 所有平台
|
||||
act_runner --version
|
||||
```
|
||||
|
||||
### 2. 安装开发工具(可选,根据需要)
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user