Files
Prism/.gitea/README.md
T
renjue 59d1087cc9
CI / test (push) Failing after 1m46s
CI / docker (push) Has been skipped
feat: Prism HTTP/SOCKS5 代理网关及管理台
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 15:08:50 +08:00

73 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Gitea Actions CI 模板(Go + Vue
复制整个 `.gitea/` 目录到新仓库即可启用 CI:**Go 测试** + **多架构 Docker 镜像**推送到 Gitea Container Registry。
## 项目约定
| 路径 | 说明 |
|------|------|
| `go.mod` | 仓库根目录,用于读取 Go 版本并跑测试 |
| `Dockerfile` | 仓库根目录,docker job 构建镜像(Vue 构建通常在此多阶段完成) |
| `web/` | 可选;若存在 `web/package.json`test job 会尝试 `npm run build` |
## 一次性配置
1. **Runner**:部署 act_runner,标签含 `ubuntu-latest`,并挂载 `docker.sock`(见 [act-runner/README.md](act-runner/README.md))。
2. **Secret**:仓库 Settings → Actions → Secrets,添加 `REGISTRY_TOKEN`PAT`write:package` 权限)。
3. **Gitea Registry**:服务端 `[packages] ENABLED = true``ROOT_URL` 正确;穿透场景建议 `PUBLIC_URL_DETECTION = never`Gitea 1.26+)。
无需改 workflow 即可使用:`REGISTRY``IMAGE_NAME` 等会从 `gitea.server_url` 与仓库名自动推断。
## 可选 Variables
仓库 Settings → Actions → Variables(留空则用默认值):
| 变量 | 默认 | 说明 |
|------|------|------|
| `REGISTRY` | 从 `gitea.server_url` 解析主机名 | 如 `git.example.com` |
| `IMAGE_NAME` | 仓库名小写 | 镜像名,非 owner/repo 全路径 |
| `DOCKERFILE` | `Dockerfile` | Dockerfile 路径 |
| `DOCKER_PLATFORMS` | `linux/amd64,linux/arm64` | buildx 平台 |
| `WEB_DIR` | `web` | 前端目录 |
| `GO_TEST_SCOPE` | `./...` | `go test` 包路径 |
| `DOCKER_IMAGE_PREFIX` | (空,用 Docker Hub) | 基础镜像前缀,如 `docker.m.daocloud.io/library/` |
| `GOPROXY` | `https://goproxy.cn,direct` | Go 模块代理 |
| `GOSUMDB` | `sum.golang.google.cn` | Go checksum 数据库 |
## 触发与镜像 tag
- **pull_request**:仅 `test` job
- **push main/master**`test` + 推送 `{registry}/{owner}/{image}:latest``:sha-xxxxxxx`
- **push tag v\***:额外推送 `:v1.2.3`
示例(仓库 `rose_cat707/Prism`Gitea 在 `git.example.com`):
```text
git.example.com/rose_cat707/prism:latest
git.example.com/rose_cat707/prism:sha-35b3b48
```
## 目录结构
```text
.gitea/
├── README.md # 本文件
├── workflows/
│ └── ci.yml # 主工作流
└── act-runner/ # runner 部署参考(可选)
├── README.md
├── config.yaml
├── docker-compose.yml
└── .env.example
```
## 本地验证 Registry
```bash
host=$(echo "https://你的-gitea-地址/" | sed -e 's|^https://||' -e 's|/.*||')
curl -s -D - "https://${host}/v2/" -o /dev/null | grep -i www-authenticate
echo "$REGISTRY_TOKEN" | docker login "$host" -u 你的用户名 --password-stdin
```
`realm` 应指向公网 Gitea 域名,而非 `127.0.0.1`