# Manage releases with the CLI

This topic describes how to use the Replicated CLI to create and promote releases.

For information about creating and managing releases with the Vendor Portal, see [Manage Releases with the Vendor Portal](/vendor/releases-creating-releases).

For information about creating and managing releases with the Vendor API v3, see the [releases](https://replicated-vendor-api.readme.io/reference/createrelease) section in the Vendor API v3 documentation.

## Prerequisites

Before you create a release using the Replicated CLI, complete the following prerequisites:

* Install the Replicated CLI then authenticate with your Replicated credentials. See [Install the Replicated CLI](/reference/replicated-cli-installing).
  
* If you do not yet have an application in the Replicated Platform, create a new application using the `replicated app create APP_NAME` command. See [`app create`](/reference/replicated-cli-app-create) in _Reference_.

* Set the `REPLICATED_APP` environment variable to the slug of the target application. See [Set Environment Variables](/reference/replicated-cli-installing#env-var) in _Installing the Replicated CLI_.

  **Example**:

  ```bash
  export REPLICATED_APP=my-app-slug
  ```

## Create a release from a local directory {#dir}

You can use the Replicated CLI to create a release from a local directory that contains the release files.

To create and promote a release:

1. (Helm Charts Only) If your release contains any Helm charts:

   1. Package each Helm chart as a `.tgz` file. See [Package a Helm Chart for a Release](/vendor/helm-install-release).

   1. Move the `.tgz` file or files to the local directory that contains the release files:

       ```bash
       mv CHART_TGZ PATH_TO_RELEASE_DIR
       ```
       Where:
       * `CHART_TGZ` is the `.tgz` Helm chart archive.
       * `PATH_TO_RELEASE_DIR` is path to the directory that contains the release files.

       **Example**

       ```bash
       mv wordpress-1.3.5.tgz manifests
       ```

   1. In the same directory that contains the release files, add a HelmChart custom resource for each Helm chart in the release. See [Configuring the HelmChart Custom Resource](helm-native-v2-using).

1. Lint the application manifest files and ensure that there are no errors in the YAML:
 
    ```bash
    replicated release lint --yaml-dir=PATH_TO_RELEASE_DIR
    ```

    Where `PATH_TO_RELEASE_DIR` is the path to the directory with the release files.

    For more information, see [release lint](/reference/replicated-cli-release-lint) and [Linter Rules](/reference/linter).   

1. Do one of the following:

   * **Create and promote the release with one command**:

      ```bash
      replicated release create --yaml-dir PATH_TO_RELEASE_DIR --lint --promote CHANNEL
      ```
      Where:
      * `PATH_TO_RELEASE_DIR` is the path to the directory with the release files.
      * `CHANNEL` is the channel ID or the case sensitive name of the channel.

      For a complete list of options for the command, see [release create](/reference/replicated-cli-release-create).

   * **Create and edit the release before promoting**:

      1. Create the release:

          ```bash
          replicated release create --yaml-dir PATH_TO_RELEASE_DIR
          ```
          Where `PATH_TO_RELEASE_DIR` is the path to the directory with the release files.

          For more information, see [release create](/reference/replicated-cli-release-create).

      1. Edit and update the release as desired:

          ```
          replicated release update SEQUENCE --yaml-dir PATH_TO_RELEASE_DIR
          ```
          Where:
            
          -  `SEQUENCE` is the release sequence number. This identifies the existing release to be updated.
          -  `PATH_TO_RELEASE_DIR` is the path to the directory with the release files.

          For more information, see [release update](/reference/replicated-cli-release-update).

      1. Promote the release when you are ready to test it. Releases cannot be edited after they are promoted. To make changes after promotion, create a new release.

          ```
          replicated release promote SEQUENCE CHANNEL
          ```

          Where:
            
          -  `SEQUENCE` is the release sequence number.
          -  `CHANNEL` is the channel ID or the case sensitive name of the channel.

          For more information, see [release promote](/reference/replicated-cli-release-promote).

1. Verify that the release was promoted to the target channel:

    ```
    replicated release ls
    ```