更新 .cnb.yml 配置,删除不必要的文件,添加 Gitea 同步功能,更新图标链接,重构环境变量示例
This commit is contained in:
39
.cnb.yml
39
.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
|
||||
# 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
11
.cnb/web_trigger.yml
Normal 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
|
||||
22
.github/workflows/git-sync.yml
vendored
22
.github/workflows/git-sync.yml
vendored
@@ -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
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -30,3 +30,8 @@ tsconfig.node.tsbuildinfo
|
||||
.turbo
|
||||
|
||||
.pnpm-store
|
||||
|
||||
.tanstack
|
||||
.env
|
||||
|
||||
!.env.example
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
@@ -1,2 +0,0 @@
|
||||
import { program, Command } from 'commander';
|
||||
export { program, Command };
|
||||
Reference in New Issue
Block a user