# Drone CI

> Automate your frequent localization tasks such as uploading source files and downloading translations.

URL: https://store.crowdin.com/drone-ci
Identifier: drone-ci
Category: Development
Type: Guide
Author: Andrii Bodnar

Use [Drone CI](https://www.drone.io/) with Crowdin CLI to automate your frequent localization tasks such as uploading source files, downloading translations or anything else you can do with Crowdin CLI.

Drone CI is a self-service, open source continuous integration and delivery platform that automates software build, test, deployment, as well as **synchronize localization resources** between repo and Crowdin project.

### Preparing the repository

Push the `crowdin.yml` [configuration file](https://developer.crowdin.com/configuration-file/) to the repository.

Use [Environment Variables](https://developer.crowdin.com/configuration-file/#api-credentials-from-environment-variables) for API Credentials:

```yml
"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
```

See the [Encrypted secrets](https://docs.drone.io/secret/encrypted/) to learn more about defining secrets in Drone CI.

### Pipeline configuration

You need to set up the `.drone.yml` configuration file (or extend the existing one):

```yml
kind: pipeline
name: default

steps:
- name: Localization

  image: crowdin/cli

  environment:
    CROWDIN_PROJECT_ID:
      from_secret: crowdin_project_id
    CROWDIN_PERSONAL_TOKEN:
      from_secret: crowdin_personal_token

  commands:
  - crowdin push
  - crowdin pull --no-progress --keep-archive
  
  # process downloaded translations

trigger:
  branch:
  - master
```

For more information about Crowdin CLI commands visit the official [Crowdin CLI website](https://crowdin.github.io/crowdin-cli/).
