> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/stormkit-io/stormkit-io/llms.txt
> Use this file to discover all available pages before exploring further.

# Auto Deployments

> Automatically deploy your applications on commits, pull requests, and custom patterns.

## Overview

Stormkit can automatically deploy your applications when code is pushed to your repository. By default, auto deployments are **disabled** for new applications.

## Enabling Auto Deployments

<Steps>
  <Step title="Navigate to Config">
    Go to **Application** > **Environment** > **Config**
  </Step>

  <Step title="Select Auto Deploy Option">
    Click the `Auto Deploy` dropdown and choose your preferred option
  </Step>

  <Step title="Save Configuration">
    Your changes are saved automatically
  </Step>
</Steps>

## Deployment Modes

### Disabled

No automatic deployments. You must manually trigger deployments through the UI or deployment trigger API.

**Use case**: Production environments where you want full control over deployments.

### All Branches

Every branch that receives a commit is deployed automatically.

**Use case**: Development environments where you want to preview every branch.

<Note>
  This option can generate many deployments. Consider using custom branch patterns for cost control.
</Note>

### Custom Branches

Deploy only branches matching specific patterns. Supports both regex and glob patterns.

#### Pattern Examples

<CodeGroup>
  ```bash Feature Branches theme={null}
  feature/*
  ```

  ```bash Release Branches theme={null}
  release/*
  ```

  ```bash Main and Develop theme={null}
  (main|develop)
  ```

  ```bash Regex Pattern theme={null}
  ^(main|staging|feature/.*)$
  ```

  ```bash Hotfix Branches theme={null}
  hotfix/*
  ```
</CodeGroup>

**Use case**: Staging and preview environments where you want to limit deployments to specific branch naming conventions.

### Custom Commits

Deploy only commits matching specific patterns within configured branches.

#### How It Works

<Steps>
  <Step title="Branch Check">
    Stormkit first checks if the commit's branch matches the environment's configured branch
  </Step>

  <Step title="Pattern Evaluation">
    If the branch matches, the commit message is evaluated against your pattern
  </Step>

  <Step title="Deployment Trigger">
    Only commits matching both criteria trigger a deployment
  </Step>
</Steps>

#### Commit Pattern Examples

<CodeGroup>
  ```bash Release Tags theme={null}
  v[0-9]+\.[0-9]+\.[0-9]+
  ```

  ```bash Deploy Prefix theme={null}
  ^deploy:.*
  ```

  ```bash Hotfix Messages theme={null}
  .*hotfix.*
  ```

  ```bash Multiple Keywords theme={null}
  (release|deploy|publish)
  ```
</CodeGroup>

**Example Usage**:

```bash theme={null}
# This commit will trigger deployment
git commit -m "deploy: new feature"
git push origin main

# This commit will NOT trigger deployment
git commit -m "wip: work in progress"
git push origin main
```

**Use case**: Production environments where you want to deploy only on release commits or specific keywords.

## Pattern Types

Stormkit supports two pattern types:

### Glob Patterns

Simple wildcard matching:

* `*` matches any characters
* `feature/*` matches `feature/login`, `feature/checkout`
* `release-*` matches `release-v1`, `release-v2`

### Regular Expressions

Advanced pattern matching:

* `^main$` matches only "main" exactly
* `(main|develop)` matches either "main" or "develop"
* `feature/[0-9]+` matches "feature/123", "feature/456"

## Preview Links

When auto deployments are enabled, Stormkit automatically posts preview links to pull/merge requests.

### Preview Link Features

* Unique URL for each deployment
* Build status (pending, success, failure)
* Direct link to deployment logs
* Automatically updated when new commits are pushed

### Disabling Preview Links

If you don't want Stormkit to comment on pull requests:

1. Go to **Environment** > **Config**
2. Find **Preview links** setting
3. Toggle it off

<Note>
  Deployments still occur; only the PR comments are disabled.
</Note>

## Auto Publish

Auto publish automatically promotes successful deployments to production.

### Enabling Auto Publish

<Warning>
  Auto publish skips manual review. Only enable for branches with strict CI/CD and code review processes.
</Warning>

<Steps>
  <Step title="Navigate to Config">
    Go to **Environment** > **Config**
  </Step>

  <Step title="Enable Auto Publish">
    Toggle **Auto publish** on
  </Step>
</Steps>

### Auto Publish Behavior

* Only applies to commits on the **default branch**
* Deployment must succeed (exit code 0)
* Status checks (if configured) must pass
* Deployment is automatically published to environment URL

## Branch Matching Strategy

Stormkit uses the following strategy to match branches:

1. **Exact match**: Branch name exactly matches configuration
2. **Glob match**: Branch name matches glob pattern
3. **Regex match**: Branch name matches regular expression

## Best Practices

### Development Environment

```yaml theme={null}
Auto Deploy: All branches
Preview Links: Enabled
Auto Publish: Disabled
```

Deploy every branch for maximum visibility during development.

### Staging Environment

```yaml theme={null}
Auto Deploy: Custom branches (main|develop|feature/*)
Preview Links: Enabled
Auto Publish: Disabled
```

Deploy main, develop, and feature branches for testing.

### Production Environment

```yaml theme={null}
Auto Deploy: Custom commits (^v[0-9]+\.[0-9]+\.[0-9]+$)
Preview Links: Disabled
Auto Publish: Enabled (with status checks)
```

Only deploy release tags and auto-publish after status checks pass.

## Troubleshooting

### Deployment Not Triggering

<AccordionGroup>
  <Accordion title="Check auto deploy is enabled">
    Verify that **Auto Deploy** is not set to "Disabled" in environment config.
  </Accordion>

  <Accordion title="Verify branch pattern">
    Ensure your branch name matches the configured pattern. Test your regex/glob pattern.
  </Accordion>

  <Accordion title="Check repository access">
    Stormkit needs access to your repository. See [Troubleshooting](/deployments/troubleshooting#repository-is-inaccessible).
  </Accordion>

  <Accordion title="Webhook delivery">
    Check if your Git provider is sending webhooks to Stormkit. You may need to reconfigure the integration.
  </Accordion>
</AccordionGroup>

### Preview Links Not Appearing

* Verify **Preview links** setting is enabled
* Check if Stormkit has permission to comment on pull requests
* Ensure the deployment succeeded (failed deployments may not post links)

## Related Documentation

<CardGroup cols={2}>
  <Card title="Configuration" icon="gear" href="/deployments/configuration">
    Configure build settings and environment variables
  </Card>

  <Card title="Status Checks" icon="check-circle" href="/deployments/status-checks">
    Add automated tests before publishing
  </Card>
</CardGroup>
