# .cnb.yml $: vscode: - docker: image: docker.cnb.cool/kevisual/dev-env:latest services: - vscode - docker imports: https://cnb.cool/kevisual/env/-/blob/main/.env.development # 开发环境启动后会执行的任务 # stages: # - 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 env: FROM_REPO: kevisual/cnb TO_REPO: kevisual/cnb stages: - name: '同步到自己的仓库' script: echo "同步到自己的仓库 ${TO_REPO}, ${GITEA_TOKEN}" - name: 'show git remote' script: git remote -v # - name: sync to gitea # image: tencentcom/git-sync # settings: # target_url: https://git.xiongxiao.me/${TO_REPO}.git # auth_type: https # username: "oauth2" # password: ${GITEA_TOKEN} # git_user: "abearxiong" # git_email: "xiongxiao@xiongxiao.me" # sync_mode: rebase # branch: main - name: '设置 git 用户信息' script: | git config --global user.name "abearxiong" git config --global user.email "xiongxiao@xiongxiao.me" - name: '添加 gitea的origin' script: | git remote remove gitea 2>/dev/null || true git remote add gitea https://oauth2:${GITEA_TOKEN}@git.xiongxiao.me/${TO_REPO}.git git remote -v - name: '推送代码到 gitea' script: git push gitea main .common_sync_from_gitea: &common_sync_from_gitea services: - docker imports: - https://cnb.cool/kevisual/env/-/blob/main/.env.development env: FROM_REPO: kevisual/cnb TO_REPO: kevisual/cnb stages: - name: '添加 gitea的origin' script: | git remote remove gitea 2>/dev/null || true git remote add gitea https://oauth2:${GITEA_TOKEN}@git.xiongxiao.me/kevisual/cnb.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