From 925bf7aab240b76d74ab1e713d90f6631a9e6e69 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Wed, 4 Feb 2026 18:08:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.cnb.yml=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E5=88=A0=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=EF=BC=8C=E6=B7=BB=E5=8A=A0=20Gitea?= =?UTF-8?q?=20=E5=90=8C=E6=AD=A5=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=9B=BE=E6=A0=87=E9=93=BE=E6=8E=A5=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cnb.yml | 39 ++++++++++++++++++++++++++++---- .cnb/web_trigger.yml | 11 +++++++++ .env.development => .env.example | 0 .github/workflows/git-sync.yml | 22 ------------------ .gitignore | 7 +++++- public/demo.html | 2 +- script/index.ts | 15 ------------ script/program.ts | 2 -- 8 files changed, 53 insertions(+), 45 deletions(-) create mode 100644 .cnb/web_trigger.yml rename .env.development => .env.example (100%) delete mode 100644 .github/workflows/git-sync.yml delete mode 100644 script/index.ts delete mode 100644 script/program.ts diff --git a/.cnb.yml b/.cnb.yml index c01987c..d469410 100644 --- a/.cnb.yml +++ b/.cnb.yml @@ -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 \ No newline at end of file + # 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 \ No newline at end of file diff --git a/.cnb/web_trigger.yml b/.cnb/web_trigger.yml new file mode 100644 index 0000000..7194675 --- /dev/null +++ b/.cnb/web_trigger.yml @@ -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 \ No newline at end of file diff --git a/.env.development b/.env.example similarity index 100% rename from .env.development rename to .env.example diff --git a/.github/workflows/git-sync.yml b/.github/workflows/git-sync.yml deleted file mode 100644 index df1f226..0000000 --- a/.github/workflows/git-sync.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index a65168f..9065d26 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,9 @@ tsconfig.node.tsbuildinfo .turbo -.pnpm-store \ No newline at end of file +.pnpm-store + +.tanstack +.env + +!.env.example \ No newline at end of file diff --git a/public/demo.html b/public/demo.html index f478e55..263fc86 100644 --- a/public/demo.html +++ b/public/demo.html @@ -4,7 +4,7 @@ - + Demo