← Back to list

The YAML File That Automates Every Software Team on Earth

The file location — .github/workflows/ci-cd.yml GitHub automatically scans this exact folder on every push. You do not register or link it…

Anshu Gupta · 2026-05-01 22:06 · 0 claps · 2.9 min read
#yaml #cicd #github #github-workflow
Open on Medium ↗
Wiki topics: ☁️ · DevOps & Cloud 🔓 · Open Source

The YAML File That Automates Every Software Team on Earth

The file location — .github/workflows/ci-cd.yml GitHub automatically scans this exact folder on every push. You do not register or link it anywhere, GitHub finds it by convention. The filename can be anything, the folder path cannot.

Part 1 — name: Just the display label shown in GitHub's Actions tab in the browser. Purely cosmetic, changing it breaks nothing and affects nothing. Think of it as the title on the recipe card.

Part 2 — on: (the trigger) This is the alarm clock. It tells GitHub when to wake up and run this workflow. The most common setup is two triggers together — push (someone merged code) and pull_request (someone proposed code). The branches: line underneath narrows it further, only watch main, ignore every other branch. Without on: the workflow never runs at all.

Part 3 — jobs: (the work) Everything inside jobs: is the actual pipeline. A workflow can have many jobs. By default all jobs run in parallel, unless you connect them with needs:, which forces one to wait for another. Every job gets its own fresh VM. Jobs are the top-level containers. Steps live inside jobs.

Job A — build:

  • **runs-on:** — which operating system the fresh VM gets. ubuntu-latest is the industry default. You only change this if your software specifically needs Windows or Mac.
  • **steps:** — the ordered list of commands that run inside this job, top to bottom, one by one.
  • **uses:** — runs a pre-built action someone else wrote, like an npm package but for pipeline steps. actions/checkout@v4 is always first — it puts your code onto the empty machine.
  • **with:** — the options you pass into a uses: action, like function arguments. node-version: '20' tells the setup action which version to install.
  • **run:** — executes a raw shell command directly on the VM. Whatever you can type in a terminal works here. npm install, npm run build, python script.py — anything.

Job B — test:

  • **needs: build** — this single line is the gate. The test job sits and waits until the build job finishes successfully. If build fails, test never starts. This enforces the order: you never test something that didn't build.
  • Everything else — runs-on, steps, uses, run — is identical in structure to Job A. Only the commands inside run: change.

Job C — deploy:

  • **needs: test** — same gate concept. Deploy waits for test. If any test fails, deploy never runs. The artifact never ships.
  • **if: github.ref == 'refs/heads/main'** — the second gate, a conditional. Even if tests pass, this job only runs when the push was to main. Feature branches test freely but never deploy. This one line is the difference between staging and production discipline.
  • **env:** — sets environment variables for the step. Used to pass secrets into commands without hardcoding them. ${{ secrets.API_KEY }} pulls the value from GitHub's encrypted secrets store — it never appears in the YAML in plain text.
  • The run: here is your deploy command — the most team-specific line in the entire file. Everything above it was nearly identical across every team. This line alone changes completely based on where you ship.

The golden rule the structure enforces: buildtestdeploy — each one only starts if the previous one succeeded, and deploy only runs on main. That chain is the entire philosophy of CI/CD in three words.

Thanks for reading!!


메타데이터
post_id
e0921ffddc68
slug
the-yaml-file-that-automates-every-software-team-on-earth-e0921ffddc68
url
https://medium.com/@rush2anshugupta/the-yaml-file-that-automates-every-software-team-on-earth-e0921ffddc68
canonical_url
https://medium.com/@rush2anshugupta/the-yaml-file-that-automates-every-software-team-on-earth-e0921ffddc68
author_url
https://medium.com/@rush2anshugupta
status
ok
fetched_at
2026-06-09 15:37:30