Some checks are pending
Build and Publish / manifest (push) Blocked by required conditions
Build and Publish / ci (push) Waiting to run
Build and Publish / docker (app) (push) Blocked by required conditions
Build and Publish / docker (email-worker) (push) Blocked by required conditions
Build and Publish / docker (git-hook) (push) Blocked by required conditions
Build and Publish / docker (gitserver) (push) Blocked by required conditions
Build and Publish / docker (migrate) (push) Blocked by required conditions
Build and Publish / docker (operator) (push) Blocked by required conditions
Build and Publish / docker-arm64 (app) (push) Blocked by required conditions
Build and Publish / docker-arm64 (email-worker) (push) Blocked by required conditions
Build and Publish / docker-arm64 (git-hook) (push) Blocked by required conditions
Build and Publish / docker-arm64 (gitserver) (push) Blocked by required conditions
Build and Publish / docker-arm64 (migrate) (push) Blocked by required conditions
1.9 KiB
1.9 KiB
Gitea Actions 配置
目录结构
.gitea/
└── workflows/
└── build.yaml # 构建流水线
快速开始
1. 启用 Gitea Actions
在 Gitea 管理面板中启用 Actions:
[actions]
ENABLED = true
2. 注册 Runner
在 Gitea 仓库设置中创建 Runner,获取 Token 后配置:
# Docker 部署
docker run -d \
--name act-runner \
-e GITEA_INSTANCE_URL=https://git.example.com \
-e GITEA_RUNNER_TOKEN=<your-token> \
-v /var/run/docker.sock:/var/run/docker.sock \
-v act-runner-data:/data \
gitea/act-runner:latest
# 或使用 Helm (见下方)
3. 添加 Secrets
在 Gitea 仓库设置中添加:
| Secret | 说明 |
|---|---|
HARBOR_USERNAME |
Harbor 用户名 |
HARBOR_PASSWORD |
Harbor 密码 |
Helm 部署 Act Runner
# values override
cat > act-runner-values.yaml << 'EOF'
actRunner:
enabled: true
replicaCount: 2
capacity: 2
labels:
- gitea
- docker
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: 2000m
memory: 4Gi
EOF
helm upgrade --install act-runner ./deploy \
-f act-runner-values.yaml \
-n c-----code \
--create-namespace
Workflow 说明
build.yaml
| Stage | 说明 |
|---|---|
ci |
格式化检查、Clippy lint、单元测试 |
docker |
x86_64 镜像构建并推送到 Harbor |
docker-arm64 |
ARM64 镜像构建 (需 ARM64 runner) |
manifest |
多架构镜像清单合并 |
Runner 标签
| Label | 说明 |
|---|---|
gitea |
默认 runner |
docker |
支持 Docker-in-Docker |
arm64 |
ARM64 架构 runner |
触发条件
- Push 到
main分支 - Pull Request 到
main分支
本地测试
使用 nektos/act 本地运行:
# 安装
curl -sSL https://raw.githubusercontent.com/nektos/act/master/install.sh | sh
# 运行 workflow
act -W .gitea/workflows/build.yaml