diff --git a/.cnb.yml b/.cnb.yml index c33a376..ae80f79 100644 --- a/.cnb.yml +++ b/.cnb.yml @@ -1,4 +1,8 @@ # .cnb.yml +include: + # - .cnb/template.yml + - https://cnb.cool/kevisual/cnb/.cnb/template.yml + $: vscode: - docker: @@ -12,51 +16,28 @@ $: # - name: pnpm install # script: pnpm install -.common_sync_to_gitea: &common_sync_to_gitea - services: - - docker - imports: - - https://cnb.cool/kevisual/env/-/blob/main/.env.development +.common_env: &common_env 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 + - <<: *common_env + stages: + - name: '启动' + script: echo '从gitea同步' web_trigger_sync_from_gitea: - - <<: *common_sync_from_gitea + - <<: *common_env + stages: + - name: '启动' + script: echo '从gitea同步' api_trigger_sync_to_gitea: - - <<: *common_sync_to_gitea + - <<: *common_env + stages: + - name: '启动' + script: echo '同步到gitea' api_trigger_sync_from_gitea: - - <<: *common_sync_from_gitea \ No newline at end of file + - <<: *common_env + stages: + - name: '启动' + script: echo '同步到gitea' diff --git a/.cnb/template.yml b/.cnb/template.yml new file mode 100644 index 0000000..97af3ea --- /dev/null +++ b/.cnb/template.yml @@ -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