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
testsdirectory 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-dagsimage-onlydags-onlydbtnon-dags
- (Default)
deploy-action, use the private network templates.
To learn more about CI/CD on Astro, see Choose a CI/CD strategy.
If you use GitHub Enterprise and cannot access the Astronomer Deploy Action, see Private network templates.
Deploy type
Thedeploy-action includes several deploy types for you to choose a specific type of code deploy for your CI/CD processes.
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, thedeploy-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
Theimage-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
Theimage-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
Thedags-only deploy option enables the deploy action to deploy only the dags in your Astro project’s dags directory to your Deployment. To deploy Dags from a different folder or to a named Dag bundle, see Deploy to named Dag bundles.
The action skips the deploy when no changed files are in the dags folder, or in dags-path when you set it. Starting with deploy-action 0.17.0, if the action can’t determine the changed files and Dag deploys are enabled on the Deployment, it deploys the Dags. This happens for a manual workflow dispatch, a push that creates a branch, or a missing diff base. Earlier versions deploy nothing in these cases.
dbt
Thedbt 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. This is most commonly used when your dbt code/logic does not live in the same repository as your Astro project.
non-dags
Thenon-dags deploy option deploys any folder as a non-Dag bundle, such as SQL files or configuration files that your Dags read at runtime. Requires deploy-action 0.17.0 or later and Astro CLI 1.44.0 or later.
root-folderis required. It’s the folder that the action deploys as the bundle.mount-pathis required. It’s the absolute path where the bundle mounts in Airflow, and the path your Dags use to read its files.non-dags-bundle-typeis optional. It’s a free-form label that appears in the Deploy History tab.
astro-project/ and sql/ side by side in your repository works, but astro-project/sql/ fails. You can’t use image-name, parse, pytest, or build-secrets with non-dags.
The action skips the deploy when no changed files are in root-folder or bundle-trigger-paths. See Monorepo support.
Deploy to named Dag bundles
On Airflow 3 Deployments, you can split your Dags into several named Dag bundles and deploy each bundle separately. Use the following inputs withdeploy-type: dags-only or deploy-type: image-and-dags:
dag-bundle-name: The name of the Dag bundle to deploy to. The bundle must already exist on the Deployment. Requires Astro CLI 1.44.0 or later.dags-path: The folder to deploy Dags from, relative toroot-folder, instead of thedagsfolder of your Astro project.no-dags-base-dir: Whentrue, removes the Dags folder prefix from the uploaded bundle. Use this input for Airflow 3 Deployments, where the bundle root is already onsys.path. This input also works withdeploy-type: infer.
deploy-action 0.17.0 or later.
To deploy several Dag bundles from one repository, add one step for each bundle. With dags-path set, a dags-only step deploys only when files in its own dags-path change.
With Astro CLI 1.45.0 or later, a dags-only deploy with dags-path doesn’t need an Astro project, so your bundles can be outside it. Leave root-folder empty, set dags-path relative to the repository root, and don’t set parse or pytest.
The following example deploys the image from astro-project and two named Dag bundles from bundles/:
dag-bundle-nameordags-pathwithdeploy-type: infer, the default.inferdeploys the image for any change outside the bundle. Usedags-only, or useimage-and-dagsto also deploy the image.dag-bundle-name,dags-path, orno-dags-base-dirwithdeploy-typeimage-only,dbt, ornon-dags, which deploy no Dags.dag-bundle-name,dags-path, orno-dags-base-dirwithimage-name. A custom image contains its own Dags.- A
dags-paththat doesn’t exist or is outside the repository.
Custom images
If you setimage-name, the action deploys your custom image as you built it. Starting with deploy-action 0.17.0, the action fails if you combine image-name with any of the following inputs:
deploy-type: dags-onlyordeploy-type: non-dagsparseorpytest, withdeploy-typeinferorimage-and-dagsbuild-secrets
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 asroot-folder. Use this input to reduce checkout size in large monorepos.image-trigger-paths: Lists paths outsideroot-folderthat also trigger a deploy when changed, for example generated files that get copied into the image at build time. Applies to theinfer,image-and-dags, andimage-onlydeploy types.bundle-trigger-paths: Lists paths outsideroot-folderthat also trigger a bundle deploy when changed, for example shared dbt macros. Applies to thedbtandnon-dagsdeploy types. Requiresdeploy-action0.17.0 or later.skip-unchanged: Set tofalseto always run the deploy dictated bydeploy-type, instead of skipping when no changed files fall underroot-folder,dags-path,image-trigger-paths, orbundle-trigger-paths. This input replaces the deprecateddeploy-image: trueinput. Starting withdeploy-action0.17.0, this input also applies to thedbtandnon-dagsdeploy types.
dbt and non-dags deploys, the action also deploys the bundle when it can’t determine the changed files, for example on a manual workflow dispatch.
See Configuration options in the Deploy Action README for full details and examples.