Skip to content

CICD-022 · Use a protected deployment environment ​

Encyclopedia · Jobs, steps and runner selection · All snippets

Previous · CICD-021 · Next · CICD-023

1. Where it fits ​

  • Placement .github/workflows/ci.yml, inside the relevant job.
  • Prerequisites workflow containing the named example jobs or steps.
  • Platforms github-actions.

2. Copy the snippet ​

yaml
environment:
  name: staging
  url: https://staging.example.com

3. How it works ​

The job references a deployment environment by name. GitHub evaluates the environment's configured protection rules before it exposes environment secrets or starts the job.

4. Verify the result ​

Configure actual environment protection in the platform and verify when the job pauses.

Validation syntax-validated (YAML parse). Status definitions.