> ## Documentation Index
> Fetch the complete documentation index at: https://docs.knowledgestack.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CI/CD Pipeline

## Overview

Knowledge Stack uses GitHub Actions for continuous integration and deployment. The pipeline is split into three workflows that automate testing, building, and publishing.

## Workflows

### Test Workflow

Runs automatically on every pull request and push to the main branch. It executes three jobs in parallel:

* **Integration tests** -- Runs the full test suite with isolated database containers
* **End-to-end tests** -- Spins up the complete stack and validates full user workflows using the generated SDK
* **Linting and type checking** -- Ensures code quality standards are met

When all checks pass on the main branch, a **release** job runs automatically to determine if a new version should be published.

### Build and Deploy Workflow

Triggered automatically when a new version is released. This workflow:

1. Builds production Docker images for the API and worker services
2. Pushes images to the container registry
3. Deploys updated images to the Kubernetes cluster
4. Runs database migrations

### Publish Workflow

Also triggered automatically on new releases. It publishes the generated SDKs:

* **Python SDK** -- Published to PyPI
* **TypeScript SDK** -- Published to npm

Both SDKs are generated from the OpenAPI specification, ensuring they always match the latest API.

## Versioning

Knowledge Stack uses [semantic versioning](https://semver.org/) with automatic version bumps based on commit messages:

| Commit Prefix                  | Version Bump  | Example                            |
| ------------------------------ | ------------- | ---------------------------------- |
| `feat:`                        | Minor (1.x.0) | New feature added                  |
| `fix:`, `perf:`                | Patch (1.0.x) | Bug fix or performance improvement |
| `chore:`, `docs:`, `refactor:` | No bump       | Maintenance work                   |

Release tags follow the format `v1.24.0`.

## Self-Hosted Deployments

If you are running your own Knowledge Stack instance, you can use the same CI/CD patterns:

### Building Docker Images

```bash theme={null}
make build-api       # Build the API server image
make build-worker    # Build the ingestion worker image
```

### Running the Test Suite

```bash theme={null}
make test            # Integration tests
make e2e-test        # End-to-end tests
make lint            # Linting
make typecheck       # Type checking
```

### SDK Generation

Generate client SDKs from your running instance:

```bash theme={null}
make sdk-api-python  # Generate Python SDK
make sdk-api-ts      # Generate TypeScript SDK
```
