fix(ci): 修复 CI/CD 工作流问题
- fix: release.yml typecheck 脚本名 compile → typecheck(发版阻断 bug) - perf: CI 测试改用 test:coverage 生成覆盖率报告 - refactor: Release 复用 CI 工作流(workflow_call),消除重复 Job - feat: Release 新增 Firefox/Chrome zip 产物验证步骤 - fix: 补全 lint-staged 配置,修复 pre-commit hook 失效问题 - feat: 添加 Dependabot 自动依赖更新配置
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
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"
|
||||||
@@ -2,11 +2,10 @@ name: CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
workflow_call: # 允许 Release 工作流复用此 CI
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
@@ -67,8 +66,8 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests with coverage
|
||||||
run: npm run test
|
run: npm run test:coverage
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build (${{ matrix.browser }})
|
name: Build (${{ matrix.browser }})
|
||||||
|
|||||||
@@ -9,69 +9,15 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ── Phase 1: 全量 CI 检查 ────────────────────────────────────────────
|
# ── Phase 1: 复用 CI 全量检查 ────────────────────────────────
|
||||||
lint:
|
ci:
|
||||||
name: Lint
|
uses: ./.github/workflows/ci.yml
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
# ── Phase 2: 打包 & 发布 ─────────────────────────────────────
|
||||||
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:
|
release:
|
||||||
name: Package & Release
|
name: Package & Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [lint, typecheck, test]
|
needs: [ci]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -101,6 +47,23 @@ jobs:
|
|||||||
echo "Found Chrome zip: $CHROME_ZIP"
|
echo "Found Chrome zip: $CHROME_ZIP"
|
||||||
echo "Found Firefox zip: $FIREFOX_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
|
- name: Extract version from tag
|
||||||
id: version
|
id: version
|
||||||
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||||
|
|||||||
@@ -20,6 +20,15 @@
|
|||||||
"test:coverage": "vitest run --coverage",
|
"test:coverage": "vitest run --coverage",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{ts,tsx}": [
|
||||||
|
"eslint --fix",
|
||||||
|
"prettier --write"
|
||||||
|
],
|
||||||
|
"*.{json,md,yml,yaml,css}": [
|
||||||
|
"prettier --write"
|
||||||
|
]
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@dnd-kit/sortable": "^10.0.0",
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user