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

# Astro CI/CD templates for Drone

Use the following CI/CD templates to automate deploying Apache Airflow dags from a Git repository to Astro with [Drone CI](https://www.drone.io/).

The template for DroneCI is based on the [image deploy template](/docs/astro/ci-cd-templates/template-overview) with a [single branch implementation](#single-branch-implementation), which requires only one Astro Deployment.

If you use the [dag-only deploy feature](/docs/astro/deploy-dags) on Astro or you're interested in a multiple-branch implementation, see [Template overview](/docs/astro/ci-cd-templates/template-overview#multiple-branch-implementation) to configure your own. To learn more about CI/CD on Astro, see [Choose a CI/CD strategy](/docs/astro/set-up-ci-cd).

## Prerequisites

* An [Astro project](/docs/cli/v1.43/develop-project#create-an-astro-project) hosted in a Git repository that Drone can access.
* An [Astro Deployment](/docs/astro/create-deployment).
* A [Deployment API token](/docs/astro/deployment-api-tokens), [Workspace API token](/docs/astro/workspace-api-tokens), or [Organization API token](/docs/astro/organization-api-tokens).
* A functional Drone [server](https://docs.drone.io/server/overview/).
* A user with admin privileges to your Drone server.
* A [Docker runner](https://docs.drone.io/runner/docker/overview/).

## Single branch implementation

1. Set the following environment variable as a repository-level [secret](https://docs.drone.io/secret/repository/) on Drone:

* `ASTRO_API_TOKEN`: The value for your Workspace or Organization API token.

2. In your Drone server, open your Astro project repository and go to **Settings** > **General**. Under **Project Settings**, turn on the **Trusted** setting.

3. In the top level of your Git repository, create a file called `.drone.yml` that includes the following configuration:

```yaml title=".drone.yml" expandable wrap theme={null}
---
kind: pipeline
type: docker
name: deploy

steps:
  - name: install
    image: debian
    commands:
    - apt-get update
    - apt-get -y install curl
    - curl -sSL install.astronomer.io | sudo bash -s
  - name: wait
    image: docker:dind
    volumes:
    - name: dockersock
      path: /var/run
    commands:
    - sleep 5
  - name: deploy
    image: docker:dind
    volumes:
    - name: dockersock
      path: /var/run
    commands:
    - astro deploy <your-deployment-id> -f
    depends_on:
    - wait
    environment:
      ASTRO_API_TOKEN:
        from_secret: ASTRO_API_TOKEN

services:
- name: docker
  image: docker:dind
  privileged: true
  volumes:
  - name: dockersock
    path: /var/run

volumes:
- name: dockersock
  temp: {}

trigger:
  branch:
  - main
  event:
  - push
```
