teluzia.Cloud Engineer · Day 106
CHAPTER 16 · CI/CD AND AUTOMATED DEPLOYMENTS

GitHub Actions syntax and runners

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

A workflow is the job schedule, jobs are isolated workstations, and steps are ordered tasks performed at each station. A workflow YAML file under .github/workflows defines triggers, jobs, and steps. Event selection determines which code and context run. Push, pull_request, workflow_dispatch, and other triggers have different security implications; valid YAML alone does not establish the intended workflow semantics. Steps within a job run in order on a runner. Jobs are separate unless dependencies are expressed with needs. Files do not automatically carry between arbitrary jobs; use appropriate artifacts or outputs. A matrix creates multiple executions from selected combinations and should be scoped to useful coverage.

Think of it this way

A workflow is the job schedule, jobs are isolated workstations, and steps are ordered tasks performed at each station.

TOPIC 01 / 03Step by step

Workflow events and YAML

A workflow YAML file under .github/workflows defines triggers, jobs, and steps. Event selection determines which code and context run. Push, pull_request, workflow_dispatch, and other triggers have different security implications; valid YAML alone does not establish the intended workflow semantics. For example, a pull_request workflow runs tests while a separately controlled release workflow performs deployment.

WORKED EXAMPLE
A pull_request workflow runs tests while a separately controlled release workflow performs deployment.

A manual workflow begins when an authorized user requests workflow_dispatch. GitHub reads the applicable workflow definition and constructs jobs from its configuration and event context. A pull_request trigger instead evaluates a different development event with different trust assumptions. The workflow's path under .github/workflows and supported syntax matter; a YAML file elsewhere is not automatically an active workflow.

An event starts automation. A workflow defines the automation. A context exposes metadata such as revision and event fields. Select triggers from purpose: testing untrusted contributions should not silently gain deployment credentials. Quoting and valid indentation matter, but syntactically valid YAML can still select unintended branches or events. Validate actual trigger behavior in a controlled repository. When a run seems missing, inspect event eligibility and the workflow's location before debugging a nonexistent runner. A workflow title is display metadata, not permission or execution scope.

Why this matters

A pull_request workflow runs tests while a separately controlled release workflow performs deployment.

A common trap

Do not overlook this operational distinction: Push, pull_request, workflow_dispatch, and other triggers have different security implications; valid YAML alone does not establish the intended workflow semantics.

MAKE IT VISIBLE

Rehearse a release decision

A RELEASE IS A SERIES OF DECISIONS

Can you ship without losing the old version?

This browser simulation shows why tests, plan review, health validation and rollback belong in a pipeline.

1Tests
2Plan review
3Deploy
4Health check
Currently serving: v1

Ready to run

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Workflow events and YAML

A workflow YAML file under .github/workflows defines triggers, jobs, and steps. Event selection determines which code and context run. Push, pull_request, workflow_dispatch, and other triggers have different security implications; valid YAML alone does not establish the intended workflow semantics. For example, a pull_request workflow runs tests while a separately controlled release workflow performs deployment.

WORKED EXAMPLE
A pull_request workflow runs tests while a separately controlled release workflow performs deployment.

A manual workflow begins when an authorized user requests workflow_dispatch. GitHub reads the applicable workflow definition and constructs jobs from its configuration and event context. A pull_request trigger instead evaluates a different development event with different trust assumptions. The workflow's path under .github/workflows and supported syntax matter; a YAML file elsewhere is not automatically an active workflow.

An event starts automation. A workflow defines the automation. A context exposes metadata such as revision and event fields. Select triggers from purpose: testing untrusted contributions should not silently gain deployment credentials. Quoting and valid indentation matter, but syntactically valid YAML can still select unintended branches or events. Validate actual trigger behavior in a controlled repository. When a run seems missing, inspect event eligibility and the workflow's location before debugging a nonexistent runner. A workflow title is display metadata, not permission or execution scope.

Why this matters

A pull_request workflow runs tests while a separately controlled release workflow performs deployment.

A common trap

Do not overlook this operational distinction: Push, pull_request, workflow_dispatch, and other triggers have different security implications; valid YAML alone does not establish the intended workflow semantics.

Jobs, steps, and dependencies

Steps within a job run in order on a runner. Jobs are separate unless dependencies are expressed with needs. Files do not automatically carry between arbitrary jobs; use appropriate artifacts or outputs. A matrix creates multiple executions from selected combinations and should be scoped to useful coverage. For example, a deploy job needs the build job, then downloads its reviewed artifact rather than assume the other job’s workspace is available.

WORKED EXAMPLE
A deploy job needs the build job, then downloads its reviewed artifact rather than assume the other job’s workspace is available.

A build job checks out code, installs a toolchain, runs tests, and uploads an artifact. A deployment job declares needs on build, so it waits for the dependency's successful outcome according to configured conditions. It runs in its own execution environment and must explicitly download the artifact; the earlier job's working directory is not automatically shared.

A job is an execution unit assigned to a runner. A step is an ordered action within that job. An artifact is a transferred output with a retention policy. Job outputs communicate selected values, not arbitrary filesystem state. Parallel jobs improve speed but require explicit dependencies for real ordering needs. A matrix expands combinations such as supported Python versions, increasing both coverage and execution cost. Avoid making every job depend on every other job merely for convenience; express the actual release gate and preserve failure propagation so required checks cannot be bypassed accidentally.

Why this matters

A deploy job needs the build job, then downloads its reviewed artifact rather than assume the other job’s workspace is available.

A common trap

Do not overlook this operational distinction: A matrix creates multiple executions from selected combinations and should be scoped to useful coverage.

Runner choice and trust

Hosted runners provide managed execution environments; self-hosted runners add responsibility for isolation, maintenance, and access. Untrusted code can abuse secrets or connected infrastructure if a workflow exposes them. Keep runner privileges and network reach narrowly matched to the job’s purpose. For example, do not run arbitrary external pull-request code on a privileged runner that can access production credentials or the internal network.

WORKED EXAMPLE
Do not run arbitrary external pull-request code on a privileged runner that can access production credentials or the internal network.

A public pull request changes a test script. If a self-hosted runner executes it with access to an internal network or stored credentials, the contributor-controlled code may use that authority. Hosted execution reduces some maintenance responsibilities, but workflow permissions, secrets, actions, and event handling still determine risk.

A runner executes assigned jobs. A hosted runner is supplied by GitHub's service. A self-hosted runner is infrastructure your team operates. Choose based on required environment and isolation, then restrict which repositories and workflows may use sensitive runners. Do not assume a container around a job removes every host or network exposure. Patch and clean self-hosted environments and consider whether persistence can affect later jobs. Untrusted code should not share powerful deployment execution paths. Inspect both explicit secrets and ambient authority, including accessible cloud metadata, mounted files, sockets, and internal endpoints.

Why this matters

Do not run arbitrary external pull-request code on a privileged runner that can access production credentials or the internal network.

A common trap

Do not overlook this operational distinction: Keep runner privileges and network reach narrowly matched to the job’s purpose.

KEEP THESE WITH YOU

Today’s takeaways

Workflow events and YAML: A workflow YAML file under .github/workflows defines triggers, jobs, and steps. Event selection determines which code and context run. Push, pull_request, workflow_dispatch, and other triggers have different security implications; valid YAML alone does not establish the intended workflow semantics.

Jobs, steps, and dependencies: Steps within a job run in order on a runner. Jobs are separate unless dependencies are expressed with needs. Files do not automatically carry between arbitrary jobs; use appropriate artifacts or outputs. A matrix creates multiple executions from selected combinations and should be scoped to useful coverage.

Runner choice and trust: Hosted runners provide managed execution environments; self-hosted runners add responsibility for isolation, maintenance, and access. Untrusted code can abuse secrets or connected infrastructure if a workflow exposes them. Keep runner privileges and network reach narrowly matched to the job’s purpose.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed