Skip to main content

This version of GitHub Enterprise Server will be discontinued on 2025-08-27. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise Server. For help with the upgrade, contact GitHub Enterprise support.

Deploying to a specific environment

Specify a deployment environment in your workflow.

Prerequisites

You need to create an environment before you can use it in a workflow. See Managing environments for deployment.

Using an environment in a workflow

  1. Open the workflow file you want to edit.

  2. Use the following syntax to add a jobs.<job_id>.environment key to your workflow:

    YAML
    jobs:
      JOB-ID:
        environment: ENVIRONMENT-NAME
    

    The chosen job will now be subject to any rules configured for the specified environment.

  3. Optionally, specify a deployment URL for the environment using the following syntax:

    YAML
    jobs:
      JOB-ID:
        environment: ENVIRONMENT-NAME
        url: URL
    

    The specified URL will appear:

    • On the deployments page for the repository
    • In the visualization graph for the workflow run
    • (If a pull request triggers the workflow) As a "View deployment" button in the pull request timeline