Compare commits

...

10 Commits

Author SHA1 Message Date
xiongxiao
5691053f01 fix 2026-01-12 14:09:22 +08:00
xiongxiao
c0f018e85b test 2026-01-12 14:06:25 +08:00
xiongxiao
60b964715e update 2026-01-12 14:03:35 +08:00
xiongxiao
3cfe945a91 update 2026-01-12 14:02:30 +08:00
xiongxiao
115870b563 test 2026-01-12 14:02:05 +08:00
xiongxiao
0751c8029a updatge 2026-01-12 14:01:11 +08:00
xiongxiao
d32fce99e2 fix 2026-01-12 13:56:17 +08:00
xiongxiao
b660fa501c update 2026-01-12 13:52:10 +08:00
xiongxiao
451c4c0076 update 2026-01-12 13:50:56 +08:00
xiongxiao
0a7f48fa4e update 2026-01-12 13:50:56 +08:00
2 changed files with 84 additions and 41 deletions

View File

@@ -1,4 +1,10 @@
# .cnb.yml # .cnb.yml
include:
- https://cnb.cool/kevisual/cnb/-/blob/main/.cnb/template.yml
- config:
env:
TO_REPO: kevisual/cnb
TO_URL: git.xiongxiao.me
$: $:
vscode: vscode:
- docker: - docker:
@@ -12,51 +18,38 @@ $:
# - name: pnpm install # - name: pnpm install
# script: pnpm install # script: pnpm install
.common_sync_to_gitea: &common_sync_to_gitea .common_env: &common_env
services:
- docker
imports:
- https://cnb.cool/kevisual/env/-/blob/main/.env.development
env: env:
TO_REPO: kevisual/cnb TO_REPO: kevisual/cnb
TO_URL: git.xiongxiao.me TO_URL: git.xiongxiao.me
stages:
- name: '显示 git remote'
script: git remote -v
- name: sync to gitea
image: tencentcom/git-sync
settings:
target_url: https://${TO_URL}/${TO_REPO}.git
auth_type: https
username: "oauth2"
password: ${GITEA_TOKEN}
git_user: "abearxiong"
git_email: "xiongxiao@xiongxiao.me"
sync_mode: rebase
branch: main
.common_sync_from_gitea: &common_sync_from_gitea
services:
- docker
imports:
- https://cnb.cool/kevisual/env/-/blob/main/.env.development
env:
TO_REPO: kevisual/cnb
TO_URL: git.xiongxiao.me
stages:
- name: '添加 gitea的origin'
script: |
git remote remove gitea 2>/dev/null || true
git remote add gitea https://oauth2:${GITEA_TOKEN}@${TO_URL}/${TO_REPO}.git
- name: '同步gitea代码到当前仓库'
script: git pull gitea main
- name: '提交到原本的origin'
script: git push origin main
main: main:
web_trigger_sync_to_gitea: web_trigger_sync_to_gitea:
- <<: *common_sync_to_gitea - <<: *common_env
services: !reference [.common_sync_to_gitea, services]
imports: !reference [.common_sync_to_gitea, imports]
stages: !reference [.common_sync_to_gitea, stages]
web_trigger_sync_from_gitea: web_trigger_sync_from_gitea:
- <<: *common_sync_from_gitea - <<: *common_env
stages:
- name: "测试变量"
script: |
echo "TO_REPO: ${TO_REPO}"
echo "TO_URL: ${TO_URL}"
echo '从gitea同步'
api_trigger_sync_to_gitea: api_trigger_sync_to_gitea:
- <<: *common_sync_to_gitea - <<: *common_env
stages:
- name: "测试变量"
script: |
echo "TO_REPO: ${TO_REPO}"
echo "TO_URL: ${TO_URL}"
echo '同步到gitea'
api_trigger_sync_from_gitea: api_trigger_sync_from_gitea:
- <<: *common_sync_from_gitea - <<: *common_env
stages:
- name: "测试变量"
script: |
echo "TO_REPO: ${TO_REPO}"
echo "TO_URL: ${TO_URL}"
echo '同步到gitea'

50
.cnb/template.yml Normal file
View File

@@ -0,0 +1,50 @@
.common_sync_to_gitea: &common_sync_to_gitea
services:
- docker
imports:
- https://cnb.cool/kevisual/env/-/blob/main/.env.development
# env:
# TO_REPO: kevisual/cnb
# TO_URL: git.xiongxiao.me
stages:
- name: '显示 git remote'
script: git remote -v
- name: sync to gitea
image: tencentcom/git-sync
settings:
target_url: https://${TO_URL}/${TO_REPO}.git
auth_type: https
username: "oauth2"
password: ${GITEA_TOKEN}
git_user: "abearxiong"
git_email: "xiongxiao@xiongxiao.me"
sync_mode: rebase
branch: main
.common_sync_from_gitea: &common_sync_from_gitea
services:
- docker
imports:
- https://cnb.cool/kevisual/env/-/blob/main/.env.development
# env:
# TO_REPO: kevisual/cnb
# TO_URL: git.xiongxiao.me
stages:
- name: '添加 gitea的origin'
script: |
git remote remove gitea 2>/dev/null || true
git remote add gitea https://oauth2:${GITEA_TOKEN}@${TO_URL}/${TO_REPO}.git
- name: '同步gitea代码到当前仓库'
script: git pull gitea main
- name: '提交到原本的origin'
script: git push origin main
# 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