diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d59eddf..22de4c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Build and Push Docker Images +name: CI on: push: @@ -11,7 +11,27 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build-and-push: + lint: + name: Lint Check + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Run Biome Check + run: bun x @biomejs/biome ci . + + build: + name: Build & Push Docker + needs: lint runs-on: ubuntu-latest permissions: contents: read @@ -22,6 +42,7 @@ jobs: uses: actions/checkout@v4 - name: Log in to the Container registry + if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} @@ -33,7 +54,7 @@ jobs: with: context: . file: Dockerfile - push: true + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 609c364..57c690d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### 变更 - **Linting**: 强化了 Biome 配置,启用了更严格的 `a11y` (可访问性), `suspicious` (可疑代码), `style` (代码规范) 和 `correctness` (正确性) 检查规则。 - **配置**: 配置 `noUnknownAtRules` 规则以忽略 Tailwind CSS 特有的 At-rules。 +- **CI/CD**: 集成 Biome 检查到 GitHub Actions 工作流,确保在所有 Pull Request 中强制执行代码规范检查。 ### 修复 - **Web 可访问性**: 为所有按钮添加了显式的 `type="button"` 以符合规范。 diff --git a/biome.json b/biome.json index 3609c30..88b1ed8 100644 --- a/biome.json +++ b/biome.json @@ -72,4 +72,4 @@ } } } -} \ No newline at end of file +}