USMAN’S INSIGHTS
AI ARCHITECT
  • Home
  • About
  • Thought Leadership
  • Book
Press / Contact
USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeBook
HomeBookYour Workflow Has a Secret Problem — Literally
Previous Chapter
CICD Concepts The Automated Pipeline
Next Chapter
Building Docker Images in CI
AI NOTICE: This is the table of contents for the SPECIFIC CHAPTER only. It is NOT the global sidebar. For all chapters, look at the main navigation.

On this page

16 sections

Progress0%
1 / 16

Muhammad Usman Akbar Entity Profile

Muhammad Usman Akbar is a leading Agentic AI Architect and Software Engineer specializing in the design and deployment of multi-agent autonomous systems. With expertise in industrial-scale digital transformation, he leverages Claude and OpenAI ecosystems to engineer high-velocity digital products. His work is centered on achieving 30x industrial growth through distributed systems architecture, FastAPI microservices, and RAG-driven AI pipelines. Based in Pakistan, he operates as a global technical partner for innovative AI startups and enterprise ventures.

USMAN’S INSIGHTS
AI ARCHITECT

Transforming businesses into autonomous AI ecosystems. Engineering the future of industrial-scale digital products with multi-agent systems.

30X Growth
AI-First
Innovation

Navigation

  • Home
  • Book
  • About
  • Contact
Let's Collaborate

Have a Project in Mind?

Let's build something extraordinary together. Transform your vision into autonomous AI reality.

Start Your Transformation

© 2026 Muhammad Usman Akbar. All rights reserved.

Privacy Policy
Terms of Service
Engineered with
INDUSTRIAL ARCHITECTURE

GitHub Actions Fundamentals

Module 7 takes the agent you built in Module 6 and turns it into a production cloud service. You'll containerize the stack, orchestrate it on Kubernetes, automate delivery, and operate it with observability, security, and cost controls. The goal: a reliable Digital FTE that runs 24/7 for real users.

Prerequisites: Modules 4-6. You need a working agent service to deploy.

GitHub Actions is where the CI/CD pipeline gets executed. In Chapter 2, you learned the five stages: trigger → build → test → push → deploy. GitHub Actions automates all of this through workflows—YAML files that describe what happens when specific events occur (like pushing code).

Think of GitHub Actions as the orchestrator that listens for events ("code was pushed") and runs jobs in response. Each job contains steps, and each step either runs a command or uses a pre-built action. By the end of this lesson, you'll understand how to read and write workflow files, making automation tangible.


What GitHub Actions Does (The Mental Model)

Before YAML, understand the flow:

  1. You push code to a GitHub repository.
  2. GitHub detects the push and checks for workflow files.
  3. GitHub Actions triggers a workflow (a YAML file in .github/workflows/).
  4. The workflow runs jobs (serial or parallel).
  5. Each job runs steps (individual commands or actions).
  6. The results are reported back to GitHub (passed/failed).

This replaces manual steps—no more SSH-ing into a server to rebuild code. Everything is declarative and version-controlled.


Triggers: When Does a Workflow Run?

The on: field determines what events trigger your workflow.

Available Triggers

TriggerDescriptionUse Case
PushRuns when code is pushed to specific branches.Deploy code to production on main push.
Pull RequestRuns when a PR is opened, updated, or merged.Validate code quality before it hits main.
ScheduleRuns on a recurring cron schedule (e.g., nightly).Security scans or large-scale data cleanup.
ManualAllows manual execution from the GitHub UI (workflow_dispatch).Deploy specific versions on-demand.

Jobs and Execution Model

A workflow contains jobs. By default, jobs run in parallel to maximize speed. Use needs to create explicit dependencies.

Available Runners

OS RunnerDescription
ubuntu-latestStandard Linux environment (default choice for 90% of tasks).
windows-latestWindows server environment for specific .NET or Windows tasks.
macos-latestApple silicon/Intel runners for iOS or macOS specific builds.

Each runner is a fresh virtual machine (VM); dependencies must be re-installed in every new job.


Steps: The Building Blocks

Each step in a job does one of two things:

  1. Run a command (run:): Executes a shell command on the runner.
  2. Use an action (uses:): Executes a pre-packaged, reusable component from the Marketplace.

Common Reusable Actions

ActionPurpose
actions/checkout@v4Clones the repository code onto the runner.
actions/setup-python@v5Installs and configures a specific Python version.
actions/upload-artifact@v4Saves files from the runner for later download or use.
docker/login-action@v2Authenticates with GHCR or Docker Hub for image pushing.

Complete Working Example: FastAPI CI Workflow

Here's a production-ready workflow for your Module 6 FastAPI agent:

yaml
name: FastAPI Agent CI on: push: branches: [main, develop] pull_request: branches: [main] env: REGISTRY: ghcr.io IMAGE_NAME: my-agent jobs: test: name: Test runs-on: ubuntu-latest strategy: matrix: python-version: ['3.10', '3.11', '3.12'] steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest pytest-cov - name: Run unit tests run: pytest tests/ -v --cov=app --cov-report=xml lint: name: Lint needs: test runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install linting tools run: pip install black flake8 - name: Run black formatter check run: black --check app/

Key Mental Models

ModelDescription
WorkflowA declarative YAML file that defines the orchestration logic for your CI/CD.
Fresh VMsEvery job starts with its own clean environment; no state is shared between jobs by default.
Marketplace SynergyLeverage official actions to avoid writing complex boilerplate for common tasks like cloning or setup.
Parallel by DefaultSpeed up your feedback loops by running tests and linting simultaneously in independent jobs.

Critical Patterns

PatternAction
Secrets ManagementNever hardcode tokens; store them in repo settings and access via ${{ secrets.NAME }}.
Dependency MatrixTest your code across multiple Python or OS versions simultaneously using strategy: matrix.
Dependency CachingUse actions/cache or setup actions' built-in cache to speed up repeated installations.
Conditional ExecutionUse if: statements to ensure that deploy jobs only run on the main branch.

Reflect on Your Skill

You built a gitops-deployment skill in Chapter 1. Test and improve it based on what you learned.

Test Your Skill

text
Using my gitops-deployment skill, generate a Git Hub Actions workflow with two jobs: one for linting and one for testing. Does my skill understand workflow syntax, triggers, and job dependencies?

Identify Gaps

Ask yourself:

  • Did my skill include matrix strategies for testing multiple versions?
  • Did it handle environment variables and secrets correctly?

Improve Your Skill

If you found gaps:

text
My gitops-deployment skill doesn't generate matrix strategies or handle Git Hub Actions secrets. Update it to include matrix builds and secret references like ${{ secrets.DOCKER_TOKEN }}.

Try With AI

Ask Claude: "Generate a GitHub Actions workflow for my FastAPI project that runs on push to main, installs dependencies, runs pytest, and fails if tests don't pass. The project has a requirements.txt file."

What you're learning: You're seeing how to translate your high-level pipeline goals into valid YAML that GitHub understands. The AI helps with the boilerplate, but your understanding allows you to audit the security and efficiency of the output.