Files
cnb-center/src/pages/repos/store/build.ts
xiongxiao 20edf1893e chore: update dependencies and improve configuration handling
- Bump version to 0.0.7 in package.json and update deployment script.
- Add new dependencies in bun.lock for improved functionality.
- Modify loadFromRemote methods in Gitea and general config stores to return boolean for better error handling.
- Enhance BuildConfig component to ensure proper loading state management.
- Simplify RepoCard component by removing duplicate repository access option.
- Update WorkspaceDetailDialog to include workspace link in state management.
- Fix branch default value in createDevConfig function to use a placeholder.
2026-03-01 01:34:12 +08:00

107 lines
3.5 KiB
TypeScript
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.
export const myOrgs = ['kevisual', 'kevision', 'skillpod', 'zxj.im', 'abearxiong']
import dayjs from 'dayjs'
export const createBuildConfig = (params: { repo: string }) => {
const toRepo = params.repo!;
return `
# .cnb.yml
include:
- https://cnb.cool/kevisual/cnb/-/blob/main/.cnb/template.yml
.common_env: &common_env
env:
TO_REPO: ${toRepo}
TO_URL: git.xiongxiao.me
imports:
- https://cnb.cool/kevisual/env/-/blob/main/.env.development
.common_sync_to_gitea: &common_sync_to_gitea
- <<: *common_env
services: !reference [.common_sync_to_gitea_template, services]
stages: !reference [.common_sync_to_gitea_template, stages]
.common_sync_from_gitea: &common_sync_from_gitea
- <<: *common_env
services: !reference [.common_sync_from_gitea_template, services]
stages: !reference [.common_sync_from_gitea_template, stages]
main:
api_trigger_sync_to_gitea:
- <<: *common_sync_to_gitea
api_trigger_sync_from_gitea:
- <<: *common_sync_from_gitea
`
};
export const createCommitBlankConfig = (params: { repo?: string, event: 'api_trigger_event' }) => {
const now = dayjs().format('YYYY-MM-DD HH:mm')
const event = params?.event || 'api_trigger_event'
return `main:
${event}:
-
services:
- docker
stages:
- name: 显示 git remote
script: git remote -v
- name: commit_blank
script: |
echo "这是一个空白提交 时间: ${now}"
git commit --allow-empty -m "up: ${now}"
git push
`
}
export const createDevConfig = (params: { repo?: string, event?: string, branch?: string }) => {
const event = params?.event || 'api_trigger_event';
const branch = params?.branch || '$';
return `##### 配置开始,保留注释 #####
.common_env: &common_env
env:
# 使用环境变量管理密钥,推荐使用密钥仓库管理密钥, 详情见 readme.md
# 使用仓库密钥时,注释
## 可选 API-Key 配置(按需取消注释)
# MINIMAX_API_KEY: '' # Minimax 模型
# ZHIPU_API_KEY: '' # 智谱 AI
# BAILIAN_CODE_API_KEY: '' # 阿里云百炼
# VOLCENGINE_API_KEY: '' # 火山引擎
# CNB_API_KEY: '' # CNB API
# CNB_COOKIE: '' # 可选配置用cnb.cool的cookie
# 可选应用配置
# FEISHU_APP_ID: '' # 飞书应用 ID
# FEISHU_APP_SECRET: '' # 飞书应用密钥
USERNAME: root
ASSISTANT_CONFIG_DIR: /workspace/kevisual # ASSISTANT_CONFIG_DIR 环境变量指定了配置文件所在的目录
# CNB_KEVISUAL_ORG: kevisual # 私密仓库使用环境配置默认即可默认为当前用户组CNB_GROUP_SLUG
# CNB_KEVISUAL_APP: assistant-app # 可选配置(默认即可)
# CNB_OPENCLAW: openclaw # 仓库名(默认即可)
# CNB_OPENWEBUI: open-webui # 仓库名(默认即可)
imports:
- https://cnb.cool/kevisual/env/-/blob/main/.env.development
##### 配置结束 #####
${branch}:
${event}:
- docker:
image: docker.cnb.cool/kevisual/dev-env:latest
services:
- vscode
- docker
runner:
cpus: 16
#tags: cnb:arch:amd64:gpu
imports: !reference [.common_env, imports]
env: !reference [.common_env, env]
stages:
- name: 启动nginx
script: nginx
- name: 初始化开发机
script: zsh /workspace/scripts/init.sh
# endStages:
# - name: 结束阶段
# script: bun /workspace/scripts/end.ts
`
}