diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58ffabe..ed04136 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,32 +3,13 @@ name: 🚨 CI Checks on: pull_request: branches: - - '**' + - main + - staging jobs: - check-main-override: - runs-on: ubuntu-latest - steps: - - name: 🛑 Block direct pushes to main (unless override flag) - run: | - echo "🔍 Event: ${{ github.event_name }} | Ref: ${{ github.ref }}" - if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then - COMMIT_MSG="${{ github.event.head_commit.message }}" - echo "🔍 Commit message: $COMMIT_MSG" - if [[ "$COMMIT_MSG" != *"[override-main]"* ]]; then - echo "❌ Direct push to main is blocked. Use a PR or include [override-main] in your commit message." - exit 1 - else - echo "✅ Override flag found. Proceeding." - fi - else - echo "â„šī¸ Not a direct push to main. Proceeding." - fi - lint: name: 🔍 Lint runs-on: ubuntu-latest - needs: check-main-override steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -41,7 +22,6 @@ jobs: typecheck: name: ✅ Type Check runs-on: ubuntu-latest - needs: check-main-override steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -54,7 +34,6 @@ jobs: build: name: 🔨 Build runs-on: ubuntu-latest - needs: check-main-override steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -70,3 +49,10 @@ jobs: restore-keys: | next-${{ runner.os }}- - run: yarn build + + ci: + name: 🚨 CI Checks + runs-on: ubuntu-latest + needs: [lint, typecheck, build] + steps: + - run: echo "✅ All checks completed successfully." diff --git a/README.md b/README.md index 7697557..c76783c 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ - [Development Tools](#development-tools) - [Type Definitions](#type-definitions) - [Scripts](#scripts) +- [CI & Deployments](#ci--deployments) + - [CI Workflows Includes](#ci-workflow-includes) + - [Vercel Deploy Flow](#-vercel-deploy-flow) - [Grid Overlay Toggle](#grid-overlay-toggle) - [Breakpoints Configuration](#breakpoints-configuration) - [Layout Root (Dynamic SCSS Variables)](#layout-root-dynamic-scss-variables) @@ -204,6 +207,29 @@ Core styling configuration files: - `yarn lint:fix` - Fix ESLint errors - `yarn format` - Format code with Prettier - `yarn check-format` - Check code formatting +- `yarn typecheck` - Check Typescript types + +## CI & Deployments + +[![CI Checks](https://github.com/CFsylvester/next.js-tailwind-typescript-TEMPLATE/actions/workflows/ci.yml/badge.svg)](https://github.com/CFsylvester/next.js-tailwind-typescript-TEMPLATE/actions/workflows/ci.yml) + +This template includes a built-in GitHub Actions workflow (`ci.yml`) that runs automatically on all pull requests and pushes to `main` and `staging`. + +### CI Workflow Includes + +- 🔍 Linting with ESLint +- ✅ Type-checking with TypeScript +- 🔨 Build verification (`next build`) + +--- + +### 🌐 Vercel Deploy Flow + +| Branch | Environment | Deployment | +| ---------- | ----------- | --------------------------------- | +| `main` | Production | ✅ Auto-deploy to prod | +| `staging` | Staging | ✅ Auto-deploy to preview/staging | +| feature PR | Preview | ✅ Deploy Preview via Vercel | ## Grid Overlay Toggle