{"meta":{"title":"Deploying to a specific environment","intro":"Specify a deployment environment in your workflow.","product":"GitHub Actions","breadcrumbs":[{"href":"/en/actions","title":"GitHub Actions"},{"href":"/en/actions/how-tos","title":"How-tos"},{"href":"/en/actions/how-tos/write-workflows","title":"Write workflows"},{"href":"/en/actions/how-tos/write-workflows/choose-what-workflows-do","title":"Choose what workflows do"},{"href":"/en/actions/how-tos/write-workflows/choose-what-workflows-do/deploy-to-environment","title":"Deploy to environment"}],"documentType":"article"},"body":"# Deploying to a specific environment\n\nSpecify a deployment environment in your workflow.\n\n## Prerequisites\n\nYou need to create an environment before you can use it in a workflow. See [Managing environments for deployment](/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments#creating-an-environment).\n\n## Using an environment in a workflow\n\n1. Open the workflow file you want to edit.\n\n2. Use the following syntax to add a [`jobs.<job_id>.environment`](/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idenvironment) key to your workflow:\n\n   ```yaml copy\n   jobs:\n     JOB-ID:\n       environment: ENVIRONMENT-NAME\n   ```\n\n   The chosen job will now be subject to any rules configured for the specified environment.\n\n3. Optionally, specify a deployment URL for the environment using the following syntax:\n\n   ```yaml copy\n   jobs:\n     JOB-ID:\n       environment:\n           name: ENVIRONMENT-NAME\n           url: URL\n   ```\n\n   The specified URL will appear:\n\n   * On the deployments page for the repository\n   * In the visualization graph for the workflow run\n   * (If a pull request triggers the workflow) As a \"View deployment\" button in the pull request timeline\n\n4. Optionally, prevent a deployment object from being created by adding the `deployment` property. When set to `false`, the job still has access to environment secrets and variables, but no GitHub deployment is created:\n\n   ```yaml copy\n   jobs:\n     JOB-ID:\n       environment:\n           name: ENVIRONMENT-NAME\n           deployment: false\n   ```\n\n   This is useful for CI or testing jobs that need environment secrets but aren't actually deploying anything. For more information, see [Deploying with GitHub Actions](/en/actions/how-tos/deploy/configure-and-manage-deployments/control-deployments#using-environments-without-deployments)."}