For a given Deployment on Astro, use astro deployment variable update to update the value of an existing environment variable with the Astro CLI. To do so, you can either:
key=value pair for an existing key directly in the command..env file and load that file with --load.This command is functionally identical to editing and saving the value of an existing environment variable in the Astro UI. For more information on environment variables, see Set environment variables on Astro.
This command is recommended for automated workflows. To run this command in an automated process such as a CI/CD pipeline, you can generate an API token, then specify the ASTRO_API_TOKEN environment variable in the system running the Astro CLI:
See Organization, Workspace, and Deployment API token documentation for more details about ways to use API tokens.