Skip to content

CICD-168 · Separate verification and deployment ​

Encyclopedia · Deployment and rollback · All snippets

Previous · CICD-167 · Next · CICD-169

1. Where it fits ​

  • Placement .github/workflows/ci.yml, inside the relevant job.
  • Prerequisites protected staging environment and trusted immutable release artifacts.
  • Platforms github-actions.

2. Copy the snippet ​

yaml
needs: verify
if: github.ref == 'refs/heads/main'
environment: staging

3. How it works ​

The declared job IDs form dependency edges. Order and job outputs cross those edges, while files need an explicit transfer.

The verification result and branch both affect deployment admission.

flowchart TD
  N1["Verify job"]
  N2{"Release conditions met"}
  N1 --> N2
  N3["Main branch ref"]
  N3 --> N2
  N4["Staging environment gate"]
  N2 -->|Yes| N4
  N5["Skip deploy"]
  N2 -->|No| N5

4. Verify the result ​

Add to deployment job and keep privileged writes off PR jobs.

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