# CI/CD and automation

> Run the uip CLI non-interactively in a CI/CD pipeline to publish and run automations.

Run the `uip` CLI in a pipeline, with no browser login.

## Prerequisites

- A CI/CD system such as GitHub Actions or Azure DevOps.
- An External Application: a client ID, plus a client secret or a federated credential.

## Set up a pipeline job

1. Store the credentials as CI/CD secrets, never in the repository.
2. Install the CLI:

   ```bash
   npm install -g @uipath/cli
   ```

   See [Restricted networks and internal npm registries](install-and-set-up.md#restricted-networks-and-internal-npm-registries).

3. Sign in with the External Application:

   ```bash
   uip login --client-id env.UIPATH_CLIENT_ID --client-secret env.UIPATH_CLIENT_SECRET --tenant <tenant-name>
   ```

   Add `--authority` for a host other than `cloud.uipath.com`. For federated login, pass `--client-assertion` instead of `--client-secret`.
4. Run your publish or job command.
5. Fail the pipeline on any non-zero exit code:

   | Code | Meaning |
   | --- | --- |
   | 1 | Failure |
   | 2 | Authentication error |
   | 3 | Validation error |
   | 4 | Timeout |

   For test runs, gate on the `uip tm report get` result: before CLI 1.207.0, `uip tm wait` exits 0 even when tests fail.

Commands: [UiPath CLI documentation](https://docs.uipath.com/uipath-cli). Agent-built Studio Admin pipelines: [CI/CD pipelines](cicd-pipelines.md).
