🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Web & Software Development › Deployment: Servers, CI/CD, and Cloud Publishing › Lesson 8
TEC-WEB46-07 · Lesson 8 · 12 clock hours · theory

CI/CD Concepts and GitHub Actions Fundamentals

Objective. Students define continuous integration and continuous deployment, identify the stages of a CI/CD pipeline, and read and explain a provided GitHub Actions workflow YAML file.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

What Is Continuous Integration?

When a team of developers each writes code on their own machine and then tries to merge everything together at the end of a sprint, conflicts pile up and bugs hide until the last moment. Continuous Integration (CI) solves this by having every developer push small changes to a shared repository frequently—often many times a day. Each push automatically triggers a pipeline that compiles the code and runs a suite of automated tests. If something breaks, the team finds out within minutes, not weeks.

The goal of CI is simple: keep the shared codebase in a working state at all times.

What Is Continuous Deployment?

Continuous Deployment (CD) extends CI by automatically releasing code that passes all tests to a live environment. In some teams this means every green build goes straight to production. In others, there is an intermediate staging environment where the build is reviewed or given a final smoke test before the final promotion to production. You will also see the term Continuous Delivery, which means the release step is automated up to the point of production but requires a manual approval click to go live. The distinction matters for exam questions, so remember: deployment = fully automatic; delivery = automated pipeline, manual gate.

Stages of a CI/CD Pipeline

A pipeline is the ordered sequence of automated steps that runs every time code is pushed. The stages you need to know for this lesson are:

1. Code Push – A developer commits and pushes changes to the version-control repository (e.g., GitHub).

2. Trigger – The CI/CD platform detects the push (or a pull-request event, a tag, or a scheduled time) and starts the pipeline.

3. Build – The source code is compiled or bundled. For interpreted languages such as Python, this stage may install dependencies and lint the code instead of compiling.

4. Automated Tests – Unit tests, integration tests, and any security scans run automatically. A single failing test stops the pipeline and notifies the team.

5. Deploy to Staging – The built artifact is deployed to a staging server that mirrors production. Testers or automated end-to-end tests verify behavior in a realistic environment.

6. Deploy to Production – After staging is approved, the same artifact is deployed to the live production environment. Using the same artifact (not rebuilding) is a key best practice—it guarantees what was tested is exactly what ships.

7. Rollback Path – If production monitoring detects a problem, the pipeline can redeploy the last known-good artifact automatically or with a single command. A rollback plan must exist before you deploy, not after something goes wrong.

GitHub Actions Overview

GitHub Actions is a CI/CD platform built directly into GitHub. Workflows are defined in YAML files stored in the `.github/workflows/` directory of a repository. GitHub reads those files and runs them on cloud-hosted virtual machines called runners.

A workflow file has three essential sections:

Reading a Workflow File

Here is a minimal annotated example:

```yaml

name: Deploy App # Human-readable name shown in the GitHub UI

on:

push:

branches: [main] # Trigger: any push to the main branch

jobs:

build-and-deploy:

runs-on: ubuntu-latest # Runner OS: the latest Ubuntu image

steps:

uses: actions/checkout@v4 # Pre-built Action; clones the repo

uses: actions/setup-python@v5

with:

python-version: '3.12'

run: pip install -r requirements.txt

run: pytest --tb=short

run: ./scripts/deploy.sh

env:

API_KEY: ${{ secrets.DEPLOY_API_KEY }} # Secret stored in GitHub, never in code

```

Key points: `uses:` pulls a versioned, community-maintained Action; `run:` executes an arbitrary shell command on the runner. If any step exits with a non-zero code, GitHub Actions marks that step as failed, stops the job, and does not proceed to later steps—preventing a broken build from reaching production.

Security and Safe Practices

CI/CD pipelines frequently handle credentials, API keys, and server access. Follow these rules:

These habits protect both the production environment and any user data it holds.

Key terms10

Continuous Integration (CI)A development practice in which developers push small code changes to a shared repository frequently, triggering automated builds and tests to catch errors early.
Continuous Deployment (CD)An extension of CI in which every change that passes all automated tests is released to production automatically, without manual intervention.
PipelineThe ordered sequence of automated stages—trigger, build, test, deploy—that code passes through from a developer's push to a live environment.
GitHub ActionsA CI/CD platform integrated into GitHub that runs automated workflows defined in YAML files stored in the .github/workflows/ directory of a repository.
RunnerThe virtual machine (hosted by GitHub or self-hosted) on which a GitHub Actions job executes; specified by the runs-on key.
Workflow YAMLThe configuration file written in YAML syntax that defines a GitHub Actions workflow, including its trigger events, jobs, and steps.
Staging EnvironmentA server environment that mirrors production and is used to test a build before it is released to real users.
RollbackThe process of redeploying a previous known-good version of an application when a newly deployed version causes errors in production.
GitHub SecretAn encrypted variable stored in a GitHub repository's settings, referenced in workflow files to avoid exposing credentials in source code.
ArtifactThe compiled or packaged output of a build step that is deployed to staging and then to production; best practice is to deploy the same artifact to both environments.
In class: Draw a CI/CD pipeline flowchart labeling stages: code push, trigger, build, automated tests, deploy to staging, deploy to production, and rollback path. · Read a provided GitHub Actions workflow file (.github/workflows/deploy.yml) line by line as a class, identifying the on trigger, jobs, steps, uses actions, and run commands. · Answer a guided worksheet with 10 short-answer questions about the workflow file, including what event triggers the pipeline, which runner OS is used, and what happens if a step fails.
Materials: Whiteboard, sample GitHub Actions YAML file, GitHub Actions documentation (docs.github.com/actions), worksheet, student notebooks
Check: Worksheet scored; students must answer at least 8 of 10 items correctly (80%) and their pipeline flowchart must include all six labeled stages.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

CompTIA ITF+ – IT Concepts and Terminology
1. A developer pushes code to the main branch. Which CI/CD pipeline stage occurs immediately after the push is detected by the platform?
CompTIA Linux+ – Automation and Scripting
2. In a GitHub Actions workflow file, which top-level key defines the event that starts the workflow?
CompTIA ITF+ – IT Concepts and Terminology
3. A GitHub Actions step uses the entry `uses: actions/checkout@v4`. What does this step do?
CompTIA ITF+ – IT Concepts and Terminology
4. Which of the following BEST describes the difference between Continuous Delivery and Continuous Deployment?
CompTIA Linux+ – Automation and Scripting
5. A step in a GitHub Actions workflow exits with a non-zero return code. What happens next?
CompTIA Linux+ – Security
6. Why should API keys and deployment credentials be stored as GitHub Secrets rather than written directly in the workflow YAML file?
CompTIA ITF+ – IT Concepts and Terminology
7. A build passes all automated tests and is deployed to staging, but monitoring reveals a critical bug in production after the next release. What is the recommended FIRST response?
CompTIA Linux+ – System Management
8. In a GitHub Actions workflow, the runs-on: ubuntu-latest key specifies which of the following?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.