# Bitbucket Pipelines

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

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

Use [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) 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.

Bitbucket Pipelines is a framework that lets you configure and perform specific operations on your repositories every time you push code to the source. We can run tests, builds, move code, or restart processes, 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 [Variables and secrets](https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/) to learn more about defining variables in Bitbucket Pipelines.

### Pipeline configuration

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

```yml
image: node:20

pipelines:
  custom:
    crowdin:
      - step:
          trigger: automatic
          script:
            - echo $CROWDIN_PROJECT_ID
            - echo $CROWDIN_PERSONAL_TOKEN
            - npm install -g @crowdin/cli
            - crowdin push
```

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

## Resources

- [Console Client (CLI)](https://crowdin.github.io/crowdin-cli/)
- [Configuration File](https://developer.crowdin.com/configuration-file/)
- [Environment Variables](https://developer.crowdin.com/configuration-file/#api-credentials-from-environment-variables)
- [Bitbucket Pipelines configuration](https://support.atlassian.com/bitbucket-cloud/docs/bitbucket-pipelines-configuration-reference/)
