For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
      • AstroFully-managed data operations, powered by Apache Airflow.
      • Astro Private CloudRun Airflow-as-a-service in your environment.
      • Professional ServicesExpert Airflow services for your enterprise's success.
    • Tools
      • Cosmos
      • Orbiter
      • CLI
      • AI SDK
      • Agents
      • Blueprint
      • UpdatesThe State of Airflow 2026See the insights from over 5,800 data practitioners in the full report. Download Now ➔
  • Customers
  • Docs
    • Insights
      • Blog
      • Webinars
      • Resource Library
      • Events
    • Education
      • Academy
      • What is Airflow?
  • Pricing
Get Started Free
    • Overview
      • Overview
      • Authenticate an automation tool
        • Develop a CI/CD workflow
          • Template options
          • Jenkins
          • GitLab
          • AWS S3 bucket
          • AWS CodeBuild
          • Azure DevOps
          • GCS bucket
          • Bitbucket
          • CircleCI
          • Drone
          • Harness
      • Astro Terraform Provider
    • Book Office Hours

Product

  • Platform Overview
  • Astro
  • Astro Observe
  • Astro Private Cloud
  • Security & Trust
  • Pricing

Tools & Services

  • Cosmos
  • Docs
  • Professional Services
  • Product Updates

Use Cases

  • AI Ops
  • Data Observability
  • ETL/ELT
  • ML Ops
  • Operational Analytics
  • All Use Cases

Industries

  • Financial Services
  • Gaming
  • Retail
  • Manufacturing
  • Healthcare
  • All Industries

Resources

  • Academy
  • eBooks & Guides
  • Blog
  • Webinars
  • Events
  • The Data Flowcast Podcast
  • All Resources

Airflow

  • What is Airflow
  • Airflow on Astro
  • Airflow 3.0
  • Airflow Upgrades
  • Airflow Use Cases
  • Airflow 2.x End of Life

Company

  • Our Story
  • Customers
  • Newsroom
  • Careers
  • Contact

Support

  • Knowledge Base
  • Status
  • Contact Support
GitHubYouTubeLinkedInx
  • Legal
  • Privacy
  • Terms of Service
  • Consent Preferences

  • Do Not Sell or Share My Personal information
  • Limit the Use Of My Sensitive Personal Information

Apache Airflow®, Airflow, and the Airflow logo are trademarks of the Apache Software Foundation. Copyright © Astronomer 2026. All rights reserved.

LogoLogo
On this page
  • Prerequisites
  • Image deploy templates
  • Configuration requirements
  • Implementation
  • Configuration requirements
  • Implementation
  • Configuration requirements
  • Implementation
  • Dag deploy templates
  • Configuration requirements
  • Single branch implementation
Automation & CI/CDCI/CDCI/CD templates

Astro CI/CD templates for CircleCI

Edit this page
Built with

CircleCI is a continuous integration and continuous delivery platform that can be used to implement DevOps practices. This document provides sample CI/CD templates to automate deploying Apache Airflow dags from a GitHub repository to Astro using CircleCI.

If you have one Deployment and one environment on Astro, use the single branch implementation. If you have multiple Deployments that support development and production environments, use the multiple branch implementation. If your team builds custom Docker images, use the custom image implementation.

Refer to Template overview to see generic templates expressed as simple shell scripts or configure your own. To learn more about CI/CD on Astro, see Choose a CI/CD strategy.

Prerequisites

  • An Astro project hosted in a Git repository that CircleCI can access.
  • An Astro Deployment.
  • A Deployment API token, Workspace API token, or Organization API token.
  • A CircleCI account.

Image deploy templates

Image deploy templates build a Docker image and push it to Astro whenever you update any file in your Astro project.

Single branch
Multiple branch
Custom Image

To automate code deploys to a Deployment using CircleCI for a single branch implementation, complete the following setup in a Git-based repository that hosts an Astro project:

Configuration requirements

  • You have a main branch of an Astro project hosted in a single GitHub repository.
  • You have a production Deployment on Astro where you want to deploy your main GitHub branch.
  • You have a production CircleCI context that stores environment variables for your CI/CD workflows.

Implementation

  1. Set the following environment variables in a CircleCI context:
  • ASTRO_API_TOKEN: The value for your Workspace or Organization API token.
  • ASTRO_DEPLOYMENT_ID: The ID for your Deployment.
  1. Create a new YAML file in .circleci/config.yml that includes the following configuration:
1# Use the latest CircleCI pipeline process engine version.
2# See: https://circleci.com/docs/2.0/configuration-reference
3version: 2.1
4
5orbs:
6 docker: circleci/docker@2.0.1
7 github-cli: circleci/github-cli@2.0.0
8
9# Define a job to be invoked later in a workflow.
10# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
11jobs:
12
13 build_image_and_deploy:
14 docker:
15 - image: cimg/base:stable
16 # Add steps to the job
17 # See: https://circleci.com/docs/2.0/configuration-reference/#steps
18 steps:
19 - setup_remote_docker:
20 version: 20.10.11
21 - checkout
22 - run:
23 name: "Deploy to Astro"
24 command: |
25 curl -sSL install.astronomer.io | sudo bash -s
26 astro deploy ${ASTRO_DEPLOYMENT_ID} -f
27
28# Invoke jobs with workflows
29# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
30workflows:
31 version: 2.1
32 wf-build-and-deploy:
33 jobs:
34 - build_image_and_deploy:
35 context:
36 - <YOUR-CIRCLE-CI-CONTEXT>
37 filters:
38 branches:
39 only:
40 - <YOUR-BRANCH-NAME>

Dag deploy templates

A dag deploy template uses the --dags flag in the astro deploy command in the Astro CLI to push only dags to your Deployment.

This CI/CD pipeline deploys your dags to Astro when one or more files in your dags folder are modified. It deploys the rest of your Astro project as a Docker image when other files or directories are also modified. For more information about the benefits of this workflow, see Deploy dags only.

Configuration requirements

For each Deployment that you use with dag deploy templates, you must enable dag deploys.

If you stage multiple commits to dag files and push them all at once to your remote branch, the template only deploys dag code changes from the most recent commit. It will miss any code changes made in previous commits.

To avoid this, either push commits individually or configure your repository to Squash commits for pull requests that merge multiple commits simultaneously.

Single branch implementation

To automate code deploys to a Deployment using CircleCI, complete the following setup in a Git-based repository that hosts an Astro project:

  1. Set the following environment variables in a CircleCI context:
  • ASTRO_API_TOKEN: The value for your Workspace or Organization API token.
  • ASTRO_DEPLOYMENT_ID: The ID for your Deployment.
  1. In your project repository, create a new YAML file in .circleci/config.yml that includes the following configuration:
1# Use the latest CircleCI pipeline process engine version.
2# See: https://circleci.com/docs/2.0/configuration-reference
3version: 2.1
4
5orbs:
6 docker: circleci/docker@2.0.1
7 github-cli: circleci/github-cli@2.0.0
8
9# Define a job to be invoked later in a workflow.
10# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
11jobs:
12
13 build_image_and_deploy:
14 docker:
15 - image: cimg/base:stable
16 # Add steps to the job
17 # See: https://circleci.com/docs/2.0/configuration-reference/#steps
18 steps:
19 - setup_remote_docker:
20 version: 20.10.11
21 - checkout
22 - run:
23 name: "Build image and deploy"
24 command: |
25 curl -sSL install.astronomer.io | sudo bash -s
26 files=($(git diff-tree HEAD --name-only --no-commit-id))
27 echo ${files}
28 find="dags"
29 if [[ ${files[*]} =~ (^|[[:space:]])"$find"($|[[:space:]]) && ${#files[@]} -eq 1 ]]; then
30 echo "only deploying dags"
31 astro deploy ${ASTRO_DEPLOYMENT_ID} --dags -f;
32 else
33 echo "image deploy"
34 astro deploy ${ASTRO_DEPLOYMENT_ID} -f;
35 fi
36
37# Invoke jobs with workflows
38# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
39workflows:
40 version: 2.1
41 wf-build-and-deploy:
42 jobs:
43 - build_image_and_deploy:
44 context:
45 - <YOUR-CIRCLE-CI-CONTEXT>
46 filters:
47 branches:
48 only:
49 - <YOUR-BRANCH-NAME>

This script checks the diff between your current commit and the HEAD of your branch to which you are pushing the changes to. If the changes are only in dags then it executes a dag-only deploy. Otherwise, it executes an image-based deploy. Make sure to customize the script to use your specific branch and context.

You can customize this script to work for multiple branches as shown in the image-based multi-branch deploy template by creating separate job and workflow for each branch.