# Use the Content Hub CLI for deployment automation

To use the [Content Hub CLI](https://doc.sitecore.com/ch/en/developers/cloud-dev/content-hub-cli.html) for package-based CI/CD deployment automation, follow this workflow:

:::walkthrough
1. [Install the Content Hub CLI](https://doc.sitecore.com/ch/en/developers/cloud-dev/install-the-content-hub-cli.html)
2. [Log in with the CLI](https://doc.sitecore.com/ch/en/developers/cloud-dev/log-in-with-the-content-hub-cli.html)
3. [Initialize your working folder](https://doc.sitecore.com/ch/en/developers/cloud-dev/initialize-your-working-folder.html)
4. [Export packages from the source environment](https://doc.sitecore.com/ch/en/users/content-hub/export-a-package.html)
5. [Import packages into the target environment](https://doc.sitecore.com/ch/en/users/content-hub/import-a-package.html)
:::

> [!warning]
> Do not manually edit, move, or delete folders in import or export packages as modifying the package structure will cause failures. If you do encounter a problem after importing a modified package, we recommend you export the package again and then re-import it without any modifications.

The following list shows examples of common calls used in deployment automation. Replace `package.zip` with a valid file name. 

```csharp

# See available types - the list mirrors the one available in the portal
ch-cli system export --help

# Export a single type and wait for the response - this command runs until the package is completed and downloaded.
ch-cli system export --type EntityDefinitions --out package.zip

# Export multiple types and wait for the response.
ch-cli system export --type EntityDefinitions --type Scripts --out package.zip

# Async export that only initiates the job, but won't wait for completion (multiple types are possible as well). Adding `--order-id` returns the Order ID.
ch-cli system export --type EntityDefinitions --order-id

# Import is simpler, but always requires either a V1 or V2 package.
ch-cli system import --source package.zip --wait

# Async import
ch-cli system import --source package.zip --job-id
```

> [!note]
> To help you use the Content Hub CLI for deployment automation, we provide an [example using an Azure pipeline](https://doc.sitecore.com/ch/en/developers/cloud-dev/ci-cd-azure-pipeline-example.html). Refer to the [general best practices](https://doc.sitecore.com/ch/en/users/content-hub/importing-and-exporting-data.html) for guidance. [Migrate changes between instances](https://doc.sitecore.com/ch/en/developers/cloud-dev/migrate-changes-between-instances.html) contains additional information about migrating data.

