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

# GitHub Actions templates for deploying code to Astro

<Tip>The Astro GitHub integration can automatically deploy code from a GitHub repository to Astro without you needing to configure a GitHub action. In addition, the Astro UI shows Git metadata for each deploy on your Deployment information screen. See [Deploy code with the Astro GitHub integration](/docs/astro/deploy-github-integration) for setup steps.</Tip>

GitHub Action templates use the Astronomer-maintained `deploy-action`, which is available in the [GitHub Marketplace](https://github.com/marketplace/actions/deploy-apache-airflow-dags-to-astro). This action automates the deploy process and includes additional features for more complex automation workflows. Specifically, the action can automatically:

* Choose a deploy type based on the files that were changed in a commit. This allows you to use the same template for dag deploys and image deploys.
* Test dags as part of the deploy process and prevent deploying if any of the tests fail. These tests are defined in the `tests` directory of your Astro project.
* Create a [preview Deployment](/docs/astro/ci-cd-templates/github-actions-deployment-preview) to test your code before deploying to production. A Deployment preview is an Astro Deployment that mirrors the configuration of an existing Deployment.
* Allows you to choose the type of code deploys used by the automation:
  * (Default) `infer`
  * `image-and-dags`
  * `image-only`
  * `dags-only`
  * `dbt`

If you have one Deployment and one environment on Astro, use the [single branch implementation](/docs/astro/ci-cd-templates/template-overview#single-branch-implementation). If you have multiple Deployments that support development and production environments, use the [multiple branch implementation](/docs/astro/ci-cd-templates/template-overview#multiple-branch-implementation). If your team builds custom Docker images, use the [custom image implementation](/docs/astro/ci-cd-templates/template-overview#custom-image-implementation). If you don't have access to Astronomer's `deploy-action`, use the [private network templates](/docs/astro/ci-cd-templates/github-actions-private-network).

To learn more about CI/CD on Astro, see [Choose a CI/CD strategy](/docs/astro/set-up-ci-cd).

<Info>If you use GitHub Enterprise and cannot access the Astronomer Deploy Action, see [Private network templates](/docs/astro/ci-cd-templates/github-actions-private-network).</Info>

## Deploy type

The `deploy-action` includes several deploy types for you to choose a specific type of code deploy for your CI/CD processes.

<Info>See the [Deploy Action README](https://github.com/astronomer/deploy-action#readme) to learn more about using and customizing this action, like creating a GitHub action that can support dag and dbt deploys.</Info>

### (Default) infer

By default, the `deploy-action` uses `infer`, which allows it to determine the type of code deploy to use based on the types of files changed in a commit: Dag or Astro project. If you committed changes only to dag files, the action triggers a dag deploy. If you committed changes to any other file, the action triggers an image deploy, or `image-and-dags`. This setting does not include `dbt` deploy types. See [default deploy action](/docs/astro/ci-cd-templates/default-deploy-action).

### image-and-dags

The `image-and-dags` option enables the Deploy Action to make a full project deploy, which includes both images and dags. This option will also include code in `includes/`, `plugins/`, or any other directories in the root of the repository. For example, if you have a dbt project in a `dbt/` directory, it will be included when using this Deploy Action.

### image-only

The `image-only` option enables the Deploy Action to deploy only the Docker image of your Astro project without updating existing dags on your Deployment. Use this option when you want to push dependency or configuration changes independently of your dag code. This deploy type skips dag parsing and pytest validation. Requires Astro CLI version 1.21.0 or later.

### dags-only

The `dags-only` deploy option enables the deploy action to deploy only the dags in your Astro project's `dags` directory to your Deployment.

### dbt

The `dbt` deploy option enables the Deploy Action to deploy dbt projects to Astro, when you provide the path to a directory in your GitHub repo that contains your dbt project. See [dbt deploy action](/docs/astro/ci-cd-templates/dbt-deploy-action). This is most commonly used when your dbt code/logic does not live in the same repository as your Astro project.

## Monorepo support

If your Astro project lives in a monorepo, use the following inputs to control how the action checks out your repository and determines whether to trigger a deploy:

* `sparse-checkout`: Limits the GitHub checkout to specific folders, typically the same value as `root-folder`. Use this input to reduce checkout size in large monorepos.
* `image-trigger-paths`: Lists paths outside `root-folder` that also trigger a deploy when changed, for example generated files that get copied into the image at build time. Applies to the `infer`, `image-and-dags`, and `image-only` deploy types.
* `skip-unchanged`: Set to `false` to always run the deploy dictated by `deploy-type`, instead of skipping when no changed files fall under `root-folder` or `image-trigger-paths`. This input replaces the deprecated `deploy-image: true` input.

See [Configuration options](https://github.com/astronomer/deploy-action#configuration-options) in the Deploy Action README for full details and examples.
