更新 .cnb.yml 配置,删除不必要的文件,添加 Gitea 同步功能,更新图标链接,重构环境变量示例

This commit is contained in:
2026-02-04 18:08:05 +08:00
parent c4dbb75698
commit 925bf7aab2
8 changed files with 53 additions and 45 deletions

View File

@@ -1,4 +1,14 @@
# .cnb.yml
include:
- https://cnb.cool/kevisual/cnb/-/blob/main/.cnb/template.yml
.common_env: &common_env
env:
TO_REPO: template/vite-react-template
TO_URL: git.xiongxiao.me
imports:
- https://cnb.cool/kevisual/env/-/blob/main/.env.development
$:
vscode:
- docker:
@@ -6,8 +16,29 @@ $:
services:
- vscode
- docker
imports: https://cnb.cool/kevisual/env/-/blob/main/env.yml
imports: !reference [.common_env, imports]
# 开发环境启动后会执行的任务
stages:
- name: pnpm install
script: pnpm install
# stages:
# - name: pnpm install
# script: pnpm install
stages: !reference [.dev_template, stages]
.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:
web_trigger_sync_to_gitea:
- <<: *common_sync_to_gitea
web_trigger_sync_from_gitea:
- <<: *common_sync_from_gitea
api_trigger_sync_to_gitea:
- <<: *common_sync_to_gitea
api_trigger_sync_from_gitea:
- <<: *common_sync_from_gitea

11
.cnb/web_trigger.yml Normal file
View File

@@ -0,0 +1,11 @@
# .cnb/web_trigger.yml
branch:
# 如下按钮在分支名以 release 开头的分支详情页面显示
- reg: "^main"
buttons:
- name: 同步代码到gitea
description: 同步代码到gitea
event: web_trigger_sync_to_gitea
- name: 同步gitea代码到当前仓库
description: 同步gitea代码到当前仓库
event: web_trigger_sync_from_gitea

View File

@@ -1,22 +0,0 @@
name: Sync to CNB
on: [push]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sync to CNB Repository
run: |
docker run --rm \
-v ${{ github.workspace }}:${{ github.workspace }} \
-w ${{ github.workspace }} \
-e PLUGIN_TARGET_URL="https://cnb.cool/kevisual/vite-react-template.git" \
-e PLUGIN_AUTH_TYPE="https" \
-e PLUGIN_USERNAME="cnb" \
-e PLUGIN_PASSWORD=${{ secrets.GIT_PASSWORD }} \
-e PLUGIN_SYNC_MODE="rebase" \
tencentcom/git-sync

7
.gitignore vendored
View File

@@ -29,4 +29,9 @@ tsconfig.node.tsbuildinfo
.turbo
.pnpm-store
.pnpm-store
.tanstack
.env
!.env.example

View File

@@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/png" href="https://kevisual.xiongxiao.me/root/center/panda.png" />
<link rel="icon" type="image/png" href="https://kevisual.xiongxiao.me/root/center/panda.jpg" />
<title>Demo</title>
<style>
html,

View File

@@ -1,15 +0,0 @@
import fs from 'fs';
import path from 'path';
import { program, Command } from './program';
export const root = process.cwd();
export const clearWorkspace = () => {
const files = ['submodules', 'packages', 'pnpm-workspace.yaml', 'turbo.json'];
for (const file of files) {
fs.rmSync(path.join(root, file), { recursive: true, force: true });
}
};
program.addCommand(new Command('clear').action(clearWorkspace));
program.parse(process.argv);

View File

@@ -1,2 +0,0 @@
import { program, Command } from 'commander';
export { program, Command };