deploy-action to automates the deploy process, meaning it can selectively deploy parts of your project based on which files you changed. See Standard deploy templates for more information about the deploy-action.
Each template installs the Astro CLI with
setup-astro-cli before deploy-action runs. Astronomer recommends installing the CLI in a separate step so that you can pin or upgrade the CLI version independently of the action, including with Dependabot, and reuse a single installation across multiple deploy steps. To pin a version, set the version input, for example version: "1.40.1". If you omit this step, deploy-action installs the latest version of the Astro CLI itself.Prerequisites
- An Astro project hosted in a GitHub repository.
- An Astro Deployment.
- A Workspace API token or Organization API token.
- Access to GitHub Actions.
Deployment preview template
The standard Deployment preview template uses GitHub secrets and an Astro Workspace or Organization API token to create a preview Deployment whenever you create a new feature branch off of your main branch.Setup
- Copy and save the Deployment ID for your Astro Deployment.
Replace
<main-deployment-id> with this Deployment ID in all the scripts created in the following steps. Even though some scripts take action on the preview Deployment, the <main-deployment-id> should be same for each script.- Set the following GitHub secret in the repository hosting your Astro project:
- Key:
ASTRO_API_TOKEN - Secret:
<your-token>
- In your project repository, create a new YAML file in
.github/workflowsnameddeploy-to-preview.ymlthat includes the following configuration:
deploy-to-preview.yml
- In the same folder, create a new YAML file named
delete-preview-deployment.ymlthat includes the following configuration:
delete-preview-deployment.yml
- In the same folder, create a new YAML file named
deploy-to-main-deployment.ymlthat includes the following configuration:
deploy-to-main-deployment.yml
- (Optional) You can add optional configurations to customize your workflow.
Deployment preview template with secrets backend implementation
If you use a secrets backend to manage Airflow objects such as variables and connections, you can configure your action to grant preview Deployments access to your secrets backend. This means that dags in the preview Deployment can access your secret Airflow objects for testing purposes. This template makes use of theAIRFLOW__SECRETS__BACKEND_KWARGS environment variable to store information and credentials for your secrets backend.
Prerequisites
- A secrets backend, such as Hashicorp Vault.
Setup
- Copy and save the Deployment ID for your Astro deployment.
Replace
<main-deployment-id> with this Deployment ID in all the scripts created in the following steps. Even though some scripts take action on the preview Deployment, the <main-deployment-id> should be same for each script.- Set the following GitHub secrets in the repository hosting your Astro project. This includes your Astro API Token, so that GitHub has permissions to deploy code to your Deployments or Workspaces, and your secrets backend information stored in
AIRFLOW__SECRETS__BACKEND_KWARGS. See Configure a secrets backend for more information about configuring your secrets backend as an environment variable.
- Key 1:
ASTRO_API_TOKEN - Secret 1:
<your-token> - Key 2:
AIRFLOW__SECRETS__BACKEND_KWARGS - Secret 2:
<your-kwargs>
- In your project repository, create a new YAML file in
.github/workflowsnamedcreate-deployment-preview.ymlthat includes the following configuration.
create-deployment-preview.yml
- In the same folder, create a new YAML file named
deploy-to-preview.ymlthat includes the following configuration:
deploy-to-preview.yml
- In the same folder, create a new YAML file named
delete-preview-deployment.ymlthat includes the following configuration:
delete-preview-deployment.yml
- In the same folder, create a new YAML file named
deploy-to-main-deployment.ymlthat includes the following configuration:
deploy-to-main-deployment.yml