Sikau

GitHub Actions · Day 1 · about 25 min

CI/CD and your first workflow

What GitHub Actions does, and the shape of a workflow file.

Robots that check every push

Every time someone pushes code, something should check it still works: install, lint, test, build — and, if all is green, deploy. Doing that automatically is CI/CD (continuous integration and delivery). GitHub Actions runs it for you on GitHub's machines, described in a YAML file in your repository.

A workflow is a recipe card pinned to the repo: *when* this happens (a push), *on* this kitchen (a fresh Ubuntu machine), *do* these steps.

Anatomy of a workflow

name: Hello CI

on: push

jobs:
  hello:
    runs-on: ubuntu-latest
    steps:
      - name: Say hello
        run: echo "Hello from GitHub Actions"
      - name: Look around
        run: |
          whoami
          node --version
          echo "Triggered by ${{ github.event_name }} on ${{ github.ref_name }}"

YAML is indentation-sensitive: use spaces (two per level), never tabs. key: value pairs, and - starts a list item.

The rest of this lesson

  • What a runner isexplain
  • Where results appearexplain
  • Which machine?predict
  • Workflow vocabularymatch
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 12 lessons of GitHub Actions