diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index b32a020..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 2 -updates: - # npm 依赖 - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "weekly" - day: "monday" - open-pull-requests-limit: 10 - labels: - - "dependencies" - commit-message: - prefix: "deps" - - # GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - day: "monday" - labels: - - "dependencies" - - "ci" - commit-message: - prefix: "ci" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa66fd0..2982e62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,11 @@ name: CI on: push: - branches: [main] + branches: + - main pull_request: - branches: [main] - workflow_call: # 允许 Release 工作流复用此 CI + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -66,8 +67,8 @@ jobs: - name: Install dependencies run: npm ci - - name: Run tests with coverage - run: npm run test:coverage + - name: Run tests + run: npm run test build: name: Build (${{ matrix.browser }}) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64a8dca..373a1f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,15 +9,69 @@ permissions: contents: write jobs: - # ── Phase 1: 复用 CI 全量检查 ──────────────────────────────── - ci: - uses: ./.github/workflows/ci.yml + # ── Phase 1: 全量 CI 检查 ──────────────────────────────────────────── + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 - # ── Phase 2: 打包 & 发布 ───────────────────────────────────── + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run ESLint + run: npm run lint + + typecheck: + name: TypeScript Check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run TypeScript type check + run: npm run compile + + test: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm run test + + # ── Phase 2: 打包 & 发布 ───────────────────────────────────────────── release: name: Package & Release runs-on: ubuntu-latest - needs: [ci] + needs: [lint, typecheck, test] steps: - name: Checkout uses: actions/checkout@v4 @@ -47,23 +101,6 @@ jobs: echo "Found Chrome zip: $CHROME_ZIP" echo "Found Firefox zip: $FIREFOX_ZIP" - - name: Verify zip artifacts - run: | - if [ -z "$CHROME_ZIP" ] || [ ! -f "$CHROME_ZIP" ]; then - echo "❌ Chrome zip not found" - exit 1 - fi - echo "✅ Chrome zip: $(ls -lh "$CHROME_ZIP" | awk '{print $5}')" - - if [ -z "$FIREFOX_ZIP" ] || [ ! -f "$FIREFOX_ZIP" ]; then - echo "❌ Firefox zip not found" - exit 1 - fi - echo "✅ Firefox zip: $(ls -lh "$FIREFOX_ZIP" | awk '{print $5}')" - env: - CHROME_ZIP: ${{ steps.find_zips.outputs.chrome_zip }} - FIREFOX_ZIP: ${{ steps.find_zips.outputs.firefox_zip }} - - name: Extract version from tag id: version run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" diff --git a/package.json b/package.json index 1e29f6d..dfb9f42 100644 --- a/package.json +++ b/package.json @@ -20,15 +20,6 @@ "test:coverage": "vitest run --coverage", "typecheck": "tsc --noEmit" }, - "lint-staged": { - "*.{ts,tsx}": [ - "eslint --fix", - "prettier --write" - ], - "*.{json,md,yml,yaml,css}": [ - "prettier --write" - ] - }, "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0",