Skip to main content

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 for setup steps.

GitHub Action templates use the Astronomer-maintained deploy-action, which is available in the GitHub Marketplace. 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 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
    • dags-only
    • dbt

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. If you do not have access to Astronomer's deploy-action, use the private network templates.

To learn more about CI/CD on Astro, see Choose a CI/CD strategy.

info

If you use GitHub Enterprise and cannot access the Astronomer Deploy Action, see Private network templates.

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 to learn more about using and customizing this action, like creating a GitHub action that can support DAG and dbt deploys.

(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.

image-and-dags

The image-and-dags option enables the Deploy Action to make a full project deploy, which includes both images and DAGs.

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.

Was this page helpful?