Cloud Explainers

GitHub Actions: Full Tutorial for Beginners

GitHub Actions15 min video

A full GitHub Actions tutorial for beginners, with real runs on GitHub's own runners: what a workflow, event, runner, job, step and action are; your first workflow file in .github/workflows; why the runner starts empty (actions/checkout and actions/setup-python); running pytest on every push; catching a real bug and reverting it; checks on pull requests before the merge; a matrix of three Python versions; secrets and what a misspelled secret does; a release workflow with two jobs, needs and an artifact; GITHUB_TOKEN permissions and a 403 when publishing a release; and what GitHub Actions costs.

GitHub Actions: Full Tutorial for Beginners, the full picture: diagram of Your laptop, GitHub repository, GitHub Actions, Ubuntu runner, Job: test, The result, An event, on GitHub's machines
The whole picture, from the video's recap.

A broken test, caught in seconds

You push a bug, and nobody notices until later. GitHub Actions marks it red in seconds, on the failing line. Let's set that up, step by step.

The same push, without and with GitHub Actions: comparison table of Without vs With GitHub Actions, The push, Tests run, You find out, Which line, Where we start

That's a real run: one character changed in a small to-do app. GitHub ran the tests on a fresh machine: one failed, and the log names it.

dev@laptop: ~/todo-app
gh run list --limit 2STATUS  TITLE                              WORKFLOW  BRANCH  EVENT  ID           ELAPSED  AGE
X       Simplify overdue()                 CI        main    push   46968179249  11s      less than a minute ago
✓       CI: check out the code, set up...  CI        main    push   46968072572  12s      less than a minute ago
dev@laptop: ~/todo-app
gh run view 46968179249 --log | cut -f3- | cut -d' ' -f2- | grep -E '^E |FAILED|failed'E       AssertionError: assert ['Back up the database'] == ['Pay the invoice']
E
E         At index 0 diff: 'Back up the database' != 'Pay the invoice'
E
E         Full diff: (-: missing in left side, +: extra in left side)
E           [
E         -     'Pay the invoice',
E         +     'Back up the database',
E           ]
FAILED test_todo.py::test_overdue_finds_late_tasks - AssertionError: assert ['Back up the database'] == ['Pay the invoice']
========================= 1 failed, 2 passed in 0.02s ==========================

What GitHub Actions is

So what is GitHub Actions? Picture a recipe card pinned up in a restaurant. When an order comes in, the restaurant rents a brand-new, empty kitchen.

On GitHub, the recipe card is a workflow: a YAML file, a simple text format, kept in your repository in a folder called.github/workflows. The order is an event, like a push. The kitchen is a runner: a fresh virtual machine that GitHub starts for each job. A job is a list of steps, run in order. When it ends, the result lands on your commit: a green check, or a red X.

Two rules about jobs and steps. Inside a job, steps run one after another, on the same machine, so a file one step makes is there for the next. But separate jobs run at the same time, each on its own fresh runner, unless you say one needs another to finish first.

Steps share a machine; jobs don't: diagram of Job: test, Steps, in order, Job: deploy, Job: build

Here's what we'll build: a first workflow, tests on every push, checks on pull requests, three Pythons at once, a secret, and a release.

What you'll build: cards of A first workflow, Tests on every push, Pull request checks, Three Pythons, A secret, A release

Everything in this video is free: 21 runs, about 5 minutes of runner time. On public repositories, GitHub's standard runners cost nothing. Private ones get about two thousand Linux minutes a month on GitHub Free.

What GitHub Actions costs (GitHub Docs, billing): cards of This video, Public repositories, Private repositories, About 2,000, A Linux minute, GitHub Free

Your first workflow

Here's the project: a small to-do list app in Python. One file adds tasks and finds the overdue ones, and a test file holds three tests: small functions that check the code gives the right answer. pytest, a Python test runner, says three passed on the laptop. The code is already on GitHub, in a public repository, linked below: fork it to follow along. And gh, GitHub's command-line tool, installed and signed in once with gh auth login, finds no runs. Nothing runs yet. Everything gh shows is also on the repository's Actions tab, in the browser.

dev@laptop: ~/todo-app
lsREADME.md  test_todo.py  todo.py
dev@laptop: ~/todo-app
python3 -m pytest -q...                                                                                                      [100%]
3 passed in 0.00s
dev@laptop: ~/todo-app
git remote -vorigin	https://github.com/cloudexplainers/actions-tutorial-lab.git (fetch)
origin	https://github.com/cloudexplainers/actions-tutorial-lab.git (push)
dev@laptop: ~/todo-app
gh run listno runs found

First, four rules of YAML. A name, a colon, and its value. Indenting with spaces puts something inside the line above it, and tabs aren't allowed. A dash starts an item in a list, and a bar lets a value run over several lines.

YAML in four rules (and no tabs): cards of name: value, Indent = inside, No tabs, - a list item, | many lines

Make the folder,.github/workflows. Every YAML file in it is a workflow. Here's a first one, hello.yml, line by line. The name line is what GitHub shows. The on line picks the event: every push. Under jobs, there's one job, say-hello. Its runs-on line picks the runner: ubuntu-latest, GitHub's newest Ubuntu. And steps: two run lines, each a shell command, run in order. One says hello, the other prints the Ubuntu version.

Add it, commit, push. That push is the event. How long until GitHub has run it? Take a guess. List the latest run, with limit one, a few seconds later. Each row is one run, with its own ID: its title is your commit message, then the workflow, the branch, and what started it. Here: Hello, on main, started by a push, and a green check after 8 seconds.

dev@laptop: ~/todo-app
git add .github
dev@laptop: ~/todo-app
git commit -m 'Add a first workflow'[main 3c7a98f] Add a first workflow
 1 file changed, 8 insertions(+)
 create mode 100644 .github/workflows/hello.yml
dev@laptop: ~/todo-app
git pushEnumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 484 bytes | 484.00 KiB/s, done.
Total 5 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/cloudexplainers/actions-tutorial-lab.git
   0bfff9c..3c7a98f  main -> main
dev@laptop: ~/todo-app
gh run list --limit 1STATUS  TITLE                 WORKFLOW  BRANCH  EVENT  ID           ELAPSED  AGE
✓       Add a first workflow  Hello     main    push   46967747858  8s       less than a minute ago

gh run view, with that run's ID, shows its one job, say-hello, done in 4 seconds. The run's other seconds went to getting a runner ready. And there's a link to the same run on GitHub, under the repository's Actions tab.

dev@laptop: ~/todo-app
gh run view 46967747858
✓ main Hello · 46967747858
Triggered via push less than a minute ago

JOBS
✓ say-hello in 4s (ID 143773404930)

For more information about the job, try: gh run view --job=143773404930
View this run on GitHub: https://github.com/cloudexplainers/actions-tutorial-lab/actions/runs/46967747858

There it is: the run, its job, and how long it took. Anyone can see it, because the repository is public.

Your first workflow: browser screenshot from the video

The log has both lines: Hello from GitHub Actions, and Ubuntu 26.04.1 LTS. You only need gh run view with the log option: the cut and grep just trim it to those two lines, as they do for every log in this video. That's a machine you never set up, started in seconds.

dev@laptop: ~/todo-app
gh run view 46967747858 --log | cut -f3- | cut -d' ' -f2- | grep -E '^(Hello|PRETTY)'Hello from GitHub Actions
PRETTY_NAME="Ubuntu 26.04.1 LTS"

Run your tests on every push

Hello proved GitHub can run commands for you, but it never touched your code. Running your tests on every change, automatically, is called continuous integration, or CI. Delete hello.yml, and write ci.yml. One job, test, with two steps: list the files with ls -la, then run pytest, the same command as on the laptop.

dev@laptop: ~/todo-app
cat .github/workflows/ci.ymlname: CI
on: push
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: ls -la
      - run: python3 -m pytest
dev@laptop: ~/todo-app
git commit -m 'Run the tests on every push'[main 910316c] Run the tests on every push
 2 files changed, 8 insertions(+), 8 deletions(-)
 create mode 100644 .github/workflows/ci.yml
 delete mode 100644 .github/workflows/hello.yml
dev@laptop: ~/todo-app
git pushEnumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 446 bytes | 446.00 KiB/s, done.
Total 5 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/cloudexplainers/actions-tutorial-lab.git
   3aae6fd..910316c  main -> main

Push it. On the runner, what will ls show? Take a guess. Nothing. The folder is empty: the only entries are the folder itself and its parent. Your code was never copied there. And then pytest fails too: no module named pytest.

dev@laptop: ~/todo-app
gh run view 46967979445 --log | cut -f3- | cut -d' ' -f2- | grep -E '^(total|drwx|/usr)'total 8
drwxr-xr-x 2 runner runner 4096 Dec  2 20:51 .
drwxr-xr-x 3 runner runner 4096 Dec  2 20:51 ..
/usr/bin/python3: No module named pytest

So add three new steps. The first uses an action called checkout, which copies your code onto the runner. The second uses setup-python, and under it, a with block gives it one setting: Python 3.12. Then pip, Python's package installer, installs pytest, the missing module, and the last step, as before, runs it.

ci.yml: get the code, set up Python: code change of .github/workflows/ci.yml, - uses: actions/checkout@v7 (your code), - uses: actions/setup-python@v7 (Python 3.12), with: (a setting for the action), python-version: "3.12"

uses means: run an action, a ready-made step, shared on GitHub. actions/checkout is its repository, and the at v7 picks a major version, so a breaking version 8 can't change your workflow under you.

One action, named and pinned: diagram of uses: actions/checkout@v7, uses: = run an action, actions/checkout = where it lives, @v7 = which version, Version 8 waits until you change it

Push, and this time: green. gh run view with the job option, and the job's ID, lists every step with a check: set up, checkout, Python, pip, pytest, 8 seconds in all. The post steps at the end are the actions tidying up after themselves. And the log ends: three passed. Your tests now run on every push, on a machine that isn't yours.

dev@laptop: ~/todo-app
gh run view --job 143774592488
✓ main CI · 46968072572
Triggered via push less than a minute ago

✓ test in 8s (ID 143774592488)
  ✓ Set up job
  ✓ Run actions/checkout@v7
  ✓ Run actions/setup-python@v7
  ✓ Run pip install pytest
  ✓ Run python -m pytest
  ✓ Post Run actions/setup-python@v7
  ✓ Post Run actions/checkout@v7
  ✓ Complete job

To see the full job log, try: gh run view --log --job=143774592488
View this run on GitHub: https://github.com/cloudexplainers/actions-tutorial-lab/actions/runs/46968072572
dev@laptop: ~/todo-app
gh run view 46968072572 --log | cut -f3- | cut -d' ' -f2- | grep -E 'passed|collected'Installing collected packages: pygments, pluggy, packaging, iniconfig, pytest
collected 3 items
============================== 3 passed in 0.01s ===============================

Catch a real bug

Now break something on purpose. overdue keeps the tasks that aren't done and whose due date is before now. Flip the less-than to a greater-than, and it keeps the tasks due in the future instead. Call it a simplification, and push.

dev@laptop: ~/todo-app
git diffdiff --git a/todo.py b/todo.py
index 5c9240a..2dee5fe 100644
--- a/todo.py
+++ b/todo.py
@@ -13,4 +13,4 @@ def add(tasks, title, due=None):
 def overdue(tasks, now=None):
     """Tasks not done whose due time has passed."""
     now = now or datetime.now(UTC)
-    return [t for t in tasks if not t["done"] and t["due"] is not None and t["due"] < now]
+    return [t for t in tasks if not t["done"] and t["due"] is not None and t["due"] > now]
dev@laptop: ~/todo-app
git commit -am 'Simplify overdue()'[main 9777c19] Simplify overdue()
 1 file changed, 1 insertion(+), 1 deletion(-)
dev@laptop: ~/todo-app
git pushEnumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 287 bytes | 287.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/cloudexplainers/actions-tutorial-lab.git
   4934055..9777c19  main -> main

That's the run from the start: a red X after 11 seconds. The log says exactly what broke: the test for late tasks expected Pay the invoice, but got Back up the database, a task that isn't due yet. One failed, two passed. When a step fails, the steps after it are skipped, and the whole job turns red.

git revert undoes HEAD, the latest commit, with a new one, and the no-edit option keeps its default message. The history still shows what happened. Push, and main is green again. Nobody had to remember to run the tests. And the red X stays on the bad commit: a record of what broke, and when.

dev@laptop: ~/todo-app
git revert --no-edit HEAD[main 5195f69] Revert "Simplify overdue()"
 Date: Wed Dec 2 20:53:00 2026 +0000
 1 file changed, 1 insertion(+), 1 deletion(-)
dev@laptop: ~/todo-app
gh run list --limit 2STATUS  TITLE                        WORKFLOW  BRANCH  EVENT  ID           ELAPSED  AGE
✓       Revert "Simplify overdue()"  CI        main    push   46968260762  11s      less than a minute ago
X       Simplify overdue()           CI        main    push   46968179249  11s      less than a minute ago

Check every pull request

Better still: catch a bug before it reaches main. A pull request asks to merge a branch into main, so add pull_request to the events. GitHub then tests the branch as if it were already merged, before anyone clicks merge. Then one more change: limit push to the main branch, with a line that says branches, main. Without it, every push to a pull request's branch would start two runs: one for the push, and one for the pull request.

dev@laptop: ~/todo-app
git diffdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5ee62b1..2f6117c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,5 +1,8 @@
 name: CI
-on: push
+on:
+  push:
+    branches: [main]
+  pull_request:
 jobs:
   test:
     runs-on: ubuntu-latest

git switch -c makes a new branch called due-soon. On it, the lab repository has a function ready: it finds the tasks due in the next twenty-four hours, with a test for it. Commit, push the branch, and gh pr create opens the pull request. Its fill option takes the title from the commit.

dev@laptop: ~/todo-app
git switch -c due-soonSwitched to a new branch 'due-soon'
dev@laptop: ~/todo-app
git commit -qam 'Add due_soon()' && git push -q -u origin due-soon 2>&1 | tail -1remote:
dev@laptop: ~/todo-app
gh pr create --fillhttps://github.com/cloudexplainers/actions-tutorial-lab/pull/5

gh pr checks, with the pull request's number, 5, lists every check on it, one per job. Here, the test job failed. The pull request now carries a red X, so nobody merges it by mistake.

dev@laptop: ~/todo-app
gh pr checks 5Some checks were not successful
0 cancelled, 1 failing, 0 successful, 0 skipped, and 0 pending checks

   NAME                    DESCRIPTION  ELAPSED  URL
X  CI/test (pull_request)               9s       https://github.com/cloudexplainers/actions-tutorial-lab/acti...

Why? The log: Renew the domain, due in five days, came back as due soon. The bug is one word: the code passes the hours as days, so due soon means within twenty-four days, not twenty-four hours. Caught before anyone merged it.

dev@laptop: ~/todo-app
gh run view 46968409626 --log | cut -f3- | cut -d' ' -f2- | grep -E '^E |FAILED'E       AssertionError: assert ['Back up the...w the domain'] == ['Back up the database']
E
E         Left contains one more item: 'Renew the domain'
E
E         Full diff: (-: missing in left side, +: extra in left side)
E           [
E               'Back up the database',
E         +     'Renew the domain',
E           ]
FAILED test_todo.py::test_due_soon_looks_one_day_ahead - AssertionError: assert ['Back up the...w the domain'] == ['Back up the database']
dev@laptop: ~/todo-app
git diffdiff --git a/todo.py b/todo.py
index 7624dd3..fd68db1 100644
--- a/todo.py
+++ b/todo.py
@@ -19,5 +19,5 @@ def overdue(tasks, now=None):
 def due_soon(tasks, now=None, hours=24):
     """Tasks not done that are due within the next `hours` hours."""
     now = now or datetime.now(UTC)
-    soon = now + timedelta(days=hours)
+    soon = now + timedelta(hours=hours)
     return [t for t in tasks if not t["done"] and t["due"] is not None and now <= t["due"] <= soon]

Fix the word, and push to the same branch. You don't open a new pull request: every push to its branch runs the checks again, by itself. This time: pass.

dev@laptop: ~/todo-app
git commit -qam 'due_soon: hours, not days' && git push -q
dev@laptop: ~/todo-app
gh pr checks 5All checks were successful
0 cancelled, 0 failing, 1 successful, 0 skipped, and 0 pending checks

   NAME                    DESCRIPTION  ELAPSED  URL
✓  CI/test (pull_request)               7s       https://github.com/cloudexplainers/actions-tutorial-lab/acti...

Success, from the same pull request. Now it's safe to merge. The bug was caught on the branch, and never reached main.

Check every pull request: browser screenshot from the video

Merge it with gh pr merge. It merges on GitHub, deletes the branch, and switches you back to main. Pull, and the log has the merge on top, then the branch's two commits: the feature, and its fix. And a merge is a push to main, so CI runs once more, on main itself, on the code exactly as it is now.

dev@laptop: ~/todo-app
gh pr merge 5 --merge --delete-branch✓ Merged pull request cloudexplainers/actions-tutorial-lab#5 (Add due_soon())
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (1/1), 902 bytes | 902.00 KiB/s, done.
From https://github.com/cloudexplainers/actions-tutorial-lab
 * branch            main       -> FETCH_HEAD
   ad9fba3..591a0d8  main       -> origin/main
Updating ad9fba3..591a0d8
Fast-forward
 test_todo.py | 9 ++++++++-
 todo.py      | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
✓ Deleted local branch due-soon and switched to branch main
✓ Deleted remote branch due-soon
dev@laptop: ~/todo-app
git pull -q && git log --oneline -3591a0d8 (HEAD -> main, origin/main) Merge pull request #5 from cloudexplainers/due-soon
45ac805 (origin/due-soon) due_soon: hours, not days
b8a6de9 Add due_soon()

Test three Python versions

The README makes a promise: works on Python 3.10 and newer. But CI only tests 3.12. A matrix runs the same job once for each value in a list: here, three Python versions. setup-python reads the version from matrix.python-version, and one job becomes three, side by side.

dev@laptop: ~/todo-app
grep Python README.mdA small to-do list in Python: add tasks, and find the ones that are overdue.
Works on Python 3.10 and newer.
dev@laptop: ~/todo-app
git diffdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2f6117c..0c4b309 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,10 +6,13 @@ on:
 jobs:
   test:
     runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: ["3.10", "3.12", "3.14"]
     steps:
       - uses: actions/checkout@v7
       - uses: actions/setup-python@v7
         with:
-          python-version: "3.12"
+          python-version: ${{ matrix.python-version }}
       - run: pip install pytest
       - run: python -m pytest

Push. Three jobs run at once. Which one fails? The answer: Python 3.10. Python 3.12 shows an X too, but it never failed: GitHub canceled it the moment 3.10 failed. That's called fail-fast, and it's on by default.

dev@laptop: ~/todo-app
gh run view 46968696283
X main CI · 46968696283
Triggered via push less than a minute ago

JOBS
✓ test (3.14) in 12s (ID 143776865692)
X test (3.10) in 12s (ID 143776866106)
  ✓ Set up job
  ✓ Run actions/checkout@v7
  ✓ Run actions/setup-python@v7
  ✓ Run pip install pytest
  X Run python -m pytest
  - Post Run actions/setup-python@v7
  ✓ Post Run actions/checkout@v7
  ✓ Complete job
X test (3.12) in 17s (ID 143776866424)

ANNOTATIONS
X Process completed with exit code 2.
test (3.10): .github#31

X The strategy configuration was canceled because "test._3_10" failed
test (3.12): .github#1

X The operation was canceled.
test (3.12): .github#31


To see what failed, try: gh run view 46968696283 --log-failed
View this run on GitHub: https://github.com/cloudexplainers/actions-tutorial-lab/actions/runs/46968696283

The log: cannot import name UTC from datetime. datetime.UTC arrived in Python 3.11, so on 3.10 the app doesn't even load. The README was wrong, and only a test on 3.10 could show it. That's what a matrix is for: test every version you promise.

dev@laptop: ~/todo-app
gh run view 46968696283 --log | cut -f3- | cut -d' ' -f2- | grep -E 'ImportError|cannot import'ImportError while importing test module '/home/runner/work/actions-tutorial-lab/actions-tutorial-lab/test_todo.py'.
E   ImportError: cannot import name 'UTC' from 'datetime' (/opt/hostedtoolcache/Python/3.10.22/x64/lib/python3.10/datetime.py)

The fix: import timezone.utc, which every Python 3 has, and give it the name UTC, so the rest of the code doesn't change. Four tests pass on the laptop, push, and all three jobs are green. Now the README's promise is checked on every push.

dev@laptop: ~/todo-app
git diff todo.pydiff --git a/todo.py b/todo.py
index fd68db1..5afda68 100644
--- a/todo.py
+++ b/todo.py
@@ -1,5 +1,7 @@
 """A small to-do list: add tasks, and find the ones that are overdue."""
-from datetime import UTC, datetime, timedelta
+from datetime import datetime, timedelta, timezone
+
+UTC = timezone.utc  # datetime.UTC is new in Python 3.11


 def add(tasks, title, due=None):
dev@laptop: ~/todo-app
python3 -m pytest -q....                                                                                                     [100%]
4 passed in 0.00s
dev@laptop: ~/todo-app
gh run view 46968816972
✓ main CI · 46968816972
Triggered via push less than a minute ago

JOBS
✓ test (3.12) in 12s (ID 143777313519)
✓ test (3.14) in 16s (ID 143777313954)
✓ test (3.10) in 18s (ID 143777314168)

For more information about a job, try: gh run view --job=<job-id>
View this run on GitHub: https://github.com/cloudexplainers/actions-tutorial-lab/actions/runs/46968816972

Keep a secret

Some steps need a password or a token, to deploy or to call an API. Never write one into the workflow file: anyone who can read the repository could read it. Store it as a secret, and read it with an expression: secrets, dot, its name, inside dollar and double braces. This test workflow prints one on purpose, and reads a misspelled name too.

Secrets live in the repository's settings, or an organization's, never in its files. gh secret set stores one, encrypted, from a file holding our made-up token, so it never sits in your shell history. gh secret list shows its name, never its value. Then run the test workflow.

dev@laptop: ~/todo-app
gh secret set DEPLOY_TOKEN < ~/deploy-token.txt✓ Set Actions secret DEPLOY_TOKEN for cloudexplainers/actions-tutorial-lab
dev@laptop: ~/todo-app
gh secret listNAME          UPDATED
DEPLOY_TOKEN  less than a minute ago
dev@laptop: ~/todo-app
gh workflow run secret.yml✓ Created workflow_dispatch event for secret.yml at main
https://github.com/cloudexplainers/actions-tutorial-lab/actions/runs/46969397087

To see the created workflow run, try: gh run view 46969397087
To see runs for this workflow, try: gh run list --workflow="secret.yml"

The log prints three stars where the token was. GitHub hides any secret value it sees in a log. The workflow also printed its length, which still shows: 27 characters. And the misspelled one? No error at all. It's simply empty: zero characters. So check a secret's name twice: GitHub won't warn you.

dev@laptop: ~/todo-app
gh run view 46969397087 --log | cut -f3- | cut -d' ' -f2- | grep -E '^(The|It)'The token is ***
It has 27 characters
The misspelled one has 0

Build, then release

Testing every change is CI. Shipping it automatically once the tests pass is CD, continuous delivery. Without it, you zip the app by hand, and it's easy to ship a build the tests never saw. A tag is a name, like v1.0.0, for one commit. Last workflow: push a tag, and GitHub builds the release for you.

CI, then CD: diagram of CI, CD, By hand, A tag: v1.0.0, release.yml

It runs on a push of any tag that starts with v. Two jobs. build zips the app and uploads it as an artifact, a file one job hands to another. release says needs: build, so it waits for build, downloads the zip, and runs gh release create. gh needs a token to sign in, so the workflow hands it the job's own token, GITHUB_TOKEN.

Tag v1.0.0, and push the tag. build passes, and release fails: HTTP 403, resource not accessible by integration. The token wasn't allowed to write. A 403 means: GitHub knows who you are, but you're not allowed to do that.

dev@laptop: ~/todo-app
git tag v1.0.0 && git push -q origin v1.0.0
dev@laptop: ~/todo-app
gh run view 46969533705
X v1.0.0 Release · 46969533705
Triggered via push less than a minute ago

JOBS
✓ build in 5s (ID 143779966233)
X release in 9s (ID 143780046589)
  ✓ Set up job
  ✓ Run actions/download-artifact@v8
  X Run gh release create "$GITHUB_REF_NAME" todo-app.zip --repo "$GITHUB_REPOSITORY"
  ✓ Complete job

ANNOTATIONS
X Process completed with exit code 1.
release: .github#8


ARTIFACTS
app

To see what failed, try: gh run view 46969533705 --log-failed
View this run on GitHub: https://github.com/cloudexplainers/actions-tutorial-lab/actions/runs/46969533705
dev@laptop: ~/todo-app
gh run view 46969533705 --log | cut -f3- | cut -d' ' -f2- | grep -E 'HTTP 403|not accessible'HTTP 403: Resource not accessible by integration (https://api.github.com/repos/cloudexplainers/actions-tutorial-lab/releases)

So give the release job, and only that job, permission to write. Under the release job, add a permissions block: contents, write. Contents covers the repository's files, tags and releases. The build job still can't write; only release can. v1.0.0 still points at the old file, so commit, tag the new commit v1.0.1, push it, and both jobs pass. gh release view shows the zip, attached to the release. It was published by github-actions, the account the workflow runs as.

dev@laptop: ~/todo-app
git diffdiff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 5df6a06..789ccd1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -15,6 +15,8 @@ jobs:
   release:
     needs: build
     runs-on: ubuntu-latest
+    permissions:
+      contents: write
     steps:
       - uses: actions/download-artifact@v8
         with:
dev@laptop: ~/todo-app
git commit -qam 'Release: let the job write releases' && git push -q
dev@laptop: ~/todo-app
git tag v1.0.1 && git push -q origin v1.0.1
dev@laptop: ~/todo-app
gh run view 46969744063
✓ v1.0.1 Release · 46969744063
Triggered via push less than a minute ago

JOBS
✓ build in 6s (ID 143780705797)
✓ release in 11s (ID 143780797018)

ARTIFACTS
app

For more information about a job, try: gh run view --job=<job-id>
View this run on GitHub: https://github.com/cloudexplainers/actions-tutorial-lab/actions/runs/46969744063
dev@laptop: ~/todo-app
gh release view v1.0.1v1.0.1
github-actions[bot] released this less than a minute ago



Assets
NAME          DIGEST                                                                   SIZE
todo-app.zip  sha256:f8e78d162aee7d8cba660a2398a7b90b834277fec470def95c0470d7db41e78f  864 B

View on GitHub: https://github.com/cloudexplainers/actions-tutorial-lab/releases/tag/v1.0.1

And there it is on GitHub: release v1.0.1, with todo-app.zip, built and published by the workflow.

Build, then release: browser screenshot from the video

Recap

Four mistakes, and their fixes. No checkout: an empty runner. A version the README promises but CI never runs. A misspelled secret: silently empty. And a token without permission: a 403.

Four mistakes, four fixes: diagram of No checkout, Untested 3.10, DEPLOY_TOKN, 403

If this saved you a few red X's, a like helps other beginners find it, and subscribing brings the next full tutorial.

Every workflow and every command from this video is in the lab repository, linked in the description, fork it, and run it all yourself. Thanks for watching Cloud Explainers.

Sources

Demos: an Ubuntu laptop in Docker and a real public GitHub repository; every workflow ran on GitHub's hosted runners. The secret in the demo is a made-up value. Every command, run, log and page was real. Watch the full video on YouTube.

More videos

Kubernetes10 min

Docker vs Kubernetes: What's the Difference?

HTTP & HTTPS11 min

Every HTTP Status Code You Need to Know

PostgreSQL8 min

How to Fix PostgreSQL 'Relation Does Not Exist' Errors

Git9 min

Git Merge vs Rebase: Which One Should You Use?

APIs10 min

How API Webhooks Work

LLM infrastructure9 min

How LLM Tokens Work

Docker9 min

Docker Containers vs Virtual Machines: What's the Difference?

PostgreSQL9 min

MySQL vs PostgreSQL: Which One Should You Use?

Local LLMs (Ollama)15 min

Ollama: Full Tutorial for Beginners

Certificates & PKI (ADCS)8 min

How to Fix Certificate Errors: 'Your Connection Is Not Private'

AWS9 min

How the Amazon Ergo AI Model Works

LLM infrastructure9 min

How to Fix LLM API Rate Limit Errors (429)

LLM infrastructure9 min

RAG vs Fine-Tuning: Which One Should You Use?

Load balancing & Nginx24 min

Nginx: Full Tutorial for Beginners

Go (Golang)5 min

Golang go func(): Starting Goroutines in 5 Minutes

Terraform23 min

Terraform: Full Tutorial for Beginners

Go (Golang)5 min

Golang Generics ([T any]) in 5 Minutes

AWS9 min

How AWS Bedrock Works

LLM infrastructure8 min

How LLM Embeddings Work

Python9 min

How to Fix Python CUDA Memory Errors in PyTorch

Go (Golang)5 min

Golang Type Assertions in 5 Minutes

LLM infrastructure10 min

CPU vs GPU for LLM Inference: What Actually Changes

Google Colab (Jupyter notebooks in the cloud)15 min

Google Colab: Full Tutorial for Beginners

AWS8 min

Amazon Bedrock vs OpenRouter: Which One Should You Use?

Go (Golang)5 min

Golang Channels (chan) in 5 Minutes

Homelab & self-hosting21 min

Tailscale: Full Tutorial for Beginners

LLM infrastructure9 min

How RAG Works

Git11 min

Every Git Setting to Change on Day One

Linux9 min

WSL vs a Linux Virtual Machine: Which One Should You Use?

PostgreSQL9 min

Every PostgreSQL Setting to Change After You Install It

Docker9 min

What Happens When You Install Docker on Ubuntu

Python8 min

How to Fix Python 'Address Already in Use' Errors

Go (Golang)5 min

Golang Interfaces and Mocks in 5 Minutes

Git7 min

How to Fix Git 'Detached HEAD' State

Linux21 min

Linux Firewall with ufw: Full Tutorial for Beginners

Go (Golang)5 min

Golang defer Statements in 5 Minutes

Auth (OAuth, JWT)9 min

How to Fix OAuth 'invalid_grant' Errors

Databases & SQL11 min

The SQL Roadmap for Beginners

Go (Golang)5 min

Golang make() for Slices and Maps in 5 Minutes

Networking7 min

How to Fix Network 'No Route to Host' Errors on Linux

Linux6 min

How to Fix Linux 'Too Many Open Files' Errors

Django (Python web framework)11 min

Every Django Concept a Beginner Needs to Know

Linux24 min

SSH on Linux: Full Tutorial for Beginners

Go (Golang)5 min

Golang for range Loops in 5 Minutes

Databases & SQL10 min

SQL Databases: SQLite vs PostgreSQL

Django (Python web framework)10 min

The Django Roadmap for Beginners

Go (Golang)5 min

Golang Structs in 5 Minutes

Caching & Redis22 min

Redis: Full Tutorial for Beginners

Go (Golang)5 min

Golang context.Context in 5 Minutes

Databases & SQL7 min

How to Fix MySQL Database Error 1045: Access Denied for User

Go (Golang)5 min

Golang Method Receivers in 5 Minutes

Python8 min

How to Fix Python SSL: CERTIFICATE_VERIFY_FAILED Errors

Django (Python web framework)9 min

How to Fix Django Static Files Not Loading in Production

OpenRouter (one API for many AI models)8 min

OpenRouter vs Direct API Keys: Which One Should You Use?

Go (Golang)5 min

Golang if err != nil Checks in 5 Minutes

Go (Golang)8 min

How to Fix Golang 'go.mod File Not Found' Errors

AI agents & MCP22 min

MCP Servers: Full Tutorial for Beginners

Go (Golang)5 min

Golang Error Return Values in 5 Minutes

Python8 min

How to Fix Python ModuleNotFoundError: No Module Named

Go (Golang)5 min

Golang Pointers in 5 Minutes

Kubernetes8 min

How to Fix a Kubernetes Pod Stuck in CrashLoopBackOff

Homelab & self-hosting9 min

How to Fix a Homelab ESXi Host Not Responding

PostgreSQL24 min

PostgreSQL: Full Tutorial for Beginners

Load balancing & Nginx9 min

How a Load Balancer Works with HAProxy

Python9 min

How Python Virtual Environments Work

Homelab & self-hosting9 min

How to Fix Cloudflare Tunnel Errors in a Homelab

APIs9 min

How to Fix API CORS Errors: No 'Access-Control-Allow-Origin'

Auth (OAuth, JWT)9 min

How Authenticator App Login Codes Work (TOTP)

Git22 min

Git and GitHub: Full Tutorial for Beginners

Homelab & self-hosting10 min

How a Homelab Hypervisor Works (VMware ESXi)

Kubernetes9 min

How to Fix Kubernetes ImagePullBackOff Errors

DNS8 min

How to Fix DNS 'Temporary Failure in Name Resolution' on Linux

AWS8 min

How to Fix AWS CLI 'Unable to Locate Credentials'

Homelab & self-hosting10 min

Proxmox vs ESXi for Your Homelab: When Each One Wins

PostgreSQL10 min

PostgreSQL UUID vs Auto Increment: Which Primary Key Should You Use?

Kubernetes21 min

Kubernetes: Full Tutorial for Beginners

Networking9 min

How TCP Sockets Work

PostgreSQL7 min

How to Fix PostgreSQL 'Could Not Connect to Server'

Claude & the Claude Developer Platform9 min

Claude Code Hooks Will Finally Make Sense After This

DevOps & CI/CD9 min

DevOps with Ansible Will Finally Make Sense After This

Networking9 min

How SNMP Network Monitoring Works

Git8 min

How to Fix GitHub 'Permission Denied (publickey)' Errors

Docker21 min

Docker: Full Tutorial for Beginners

PostgreSQL7 min

How to Fix PostgreSQL 'Password Authentication Failed'

Linux8 min

Why One Linux Server Handles More Users Than You Think

Networking7 min

How to Fix Network 'Connection Refused' Errors

DevOps & CI/CD9 min

DevOps Pipelines: Jenkins vs GitHub Actions

Linux11 min

Linux Nginx Reverse Proxy: Full Tutorial for Beginners

Networking11 min

Every Networking Term a Beginner Needs in 12 Minutes

Docker6 min

How to Fix Docker 'Permission Denied' on docker.sock

Git7 min

How to Fix Git 'Updates Were Rejected' When You Push

Linux7 min

How to Fix nginx 502 Bad Gateway Errors on Linux

Linux8 min

How to Fix Linux apt 'Could Not Get Lock' Errors (Ubuntu)

Networking9 min

How Email Works on the Internet (SMTP) in 10 Minutes

Python8 min

The Python Roadmap for Beginners

Go (Golang)21 min

Golang REST API with Gin: Full Tutorial for Beginners

Networking10 min

How a WireGuard VPN Network Works

Linux9 min

Linux Makefiles Will Finally Make Sense After This

Auth (OAuth, JWT)9 min

SAML vs OAuth vs OpenID Connect: What's the Difference?

Python7 min

How to Fix Python cron Jobs That Never Run

Linux22 min

Linux Bash Scripting: Full Tutorial for Beginners

Networking10 min

How PXE Network Boot Works

Active Directory9 min

How Active Directory Works

Linux10 min

How to Fix a Linux systemd Service That Won't Start

Linux9 min

Linux Logs: syslog vs journald

Auth (OAuth, JWT)9 min

JWT vs Session Cookies: Which One Should You Use?

Docker10 min

Docker vs Docker Compose: Which One Should You Use?

Docker9 min

How to Fix Docker Compose Containers That Can't Talk to Each Other

Django (Python web framework)22 min

Django Full Tutorial for Beginners

Linux9 min

How Linux systemd Works

Networking8 min

How to Fix 'Windows Cannot Access' Network Share Errors (SMB)

APIs10 min

REST vs gRPC: Which One Should You Use?

Certificates & PKI (ADCS)9 min

How to Fix SSL Certificate Chain Errors (Missing Intermediate)

Python9 min

Every Python Concept for Beginners in 10 Minutes

Databases & SQL9 min

Every SQL Join Type in 10 Minutes

OpenRouter (one API for many AI models)9 min

Why OpenRouter Free Models Hit Their Limit So Fast

Gemini API & Google AI Studio9 min

Why Your Gemini API Free Tier Runs Out So Fast

OpenRouter (one API for many AI models)10 min

OpenRouter Will Finally Make Sense After This

Caching & Redis10 min

How Redis Caching Works

Gemini API & Google AI Studio10 min

Gemini API vs Vertex AI: Which One Should You Use?

Gemini API & Google AI Studio8 min

How to Fix a Leaked Gemini API Key

Go (Golang)9 min

Why Golang Uses Goroutines Instead of Threads

Gemini API & Google AI Studio9 min

How to Fix Gemini API Error 429: Resource Exhausted

Claude & the Claude Developer Platform10 min

Claude Token Pricing Will Finally Make Sense After This

Python11 min

Why Python Web Scraping Returns Nothing (and the Fix)

Python10 min

Python uv vs pip: Which One Should You Use?

Python22 min

Python Automation: Full Tutorial for Beginners

Auth (OAuth, JWT)9 min

How OAuth Login Works

Gemini API & Google AI Studio10 min

Google AI Studio Will Finally Make Sense After This

Docker10 min

What Happens When You Run a Docker Container

Claude & the Claude Developer Platform8 min

How to Fix Claude Code Billing Your API Key Instead of Your Plan

Auth (OAuth, JWT)9 min

Why Passkeys Can't Be Phished Like Passwords

PowerShell10 min

PowerShell vs Bash: Which One Should You Learn?

Linux10 min

The Linux Roadmap for Beginners

Django (Python web framework)9 min

Django vs FastAPI: Which One Should You Use?

Databases & SQL10 min

Why SQLite Is the Most Used Database in the World

Databases & SQL11 min

How a NoSQL Database Like MongoDB Works

Python11 min

How to Fix Python pip error: externally-managed-environment

Databases & SQL9 min

How to Fix MySQL Too Many Connections Database Errors

Go (Golang)9 min

Golang Concurrency Will Finally Make Sense After This

AWS10 min

How Amazon S3 Works

Kubernetes10 min

How Kubernetes Works

Git10 min

How Git Works

Docker10 min

How to Fix Docker Port Already Allocated Errors

PostgreSQL10 min

How PostgreSQL Works

Git8 min

How to Fix Git Merge Conflicts

Linux9 min

How to Fix No Space Left on Device in Linux

Networking10 min

How the Internet Works

Databases & SQL9 min

SQL vs NoSQL: When Each One Wins

Auth (OAuth, JWT)8 min

How to Fix JWT Token Expired Errors (401 Unauthorized)

Claude & the Claude Developer Platform9 min

Claude API vs Claude Pro: Why Your Subscription Doesn't Include It

AI agent skills9 min

Why AI Agent Skills Beat Giant Prompts

Linux10 min

Linux Cron Jobs Will Finally Make Sense After This

Cybersecurity10 min

Security Logs Will Finally Make Sense After This

Cybersecurity8 min

How to Fix a Security Leak: An API Key Pushed to GitHub

DNS9 min

DNS Will Finally Make Sense After This

Cybersecurity9 min

Never Ignore a Security Update

Auth (OAuth, JWT)9 min

Two-Factor Authentication Will Finally Make Sense

Networking8 min

Never Expose a Database to the Internet

Cybersecurity10 min

SSH Keys vs Passwords: Which Is Safer for Security?

Linux10 min

The 5 Levels of Linux Boot: From Power On to Login

Networking12 min

The 5 Levels of Network Firewalls

Cybersecurity10 min

Password Security: Why Hackers Crack Weak Passwords

Linux9 min

Why Your Linux Server Runs Out of Memory

Networking10 min

HTTP vs HTTPS: What Actually Changes on Your Network

Linux12 min

Every Linux File Permission You Need to Know

Linux10 min

Linux Processes vs Threads: When Each One Wins

Networking11 min

The OSI Model Will Finally Make Sense After This

Git11 min

The 7 Levels of Git

Networking10 min

Every Network Troubleshooting Command You Need

Cybersecurity10 min

Hashing vs Encryption in Cybersecurity: When Each One Wins

Networking11 min

Why the Internet Ran Out of IP Addresses

Linux11 min

Linux Package Managers: apt vs Snap vs Flatpak

Python9 min

Why Python Is Slow (and When It Doesn't Matter)

Networking11 min

TCP vs UDP: When Each One Wins

Linux8 min

Stop Running Linux as Root (Do This Instead)

Linux11 min

Linux Users and Groups Will Finally Make Sense

Cybersecurity9 min

Why Phishing Beats Good Security (and How to Spot It)

Docker12 min

The 7 Levels of Docker

AI agents & MCP12 min

AI Agents Will Finally Make Sense After This

Git8 min

Stop Using git push --force (Use This Instead)

AI agent skills10 min

Agent Skills vs MCP: When Each One Wins

Networking12 min

Networking Will Finally Make Sense After This

Linux12 min

Every Linux Command You Actually Need

Cybersecurity12 min

The 7 Levels of Cybersecurity

System design12 min

Every System Design Concept You Need, in One Diagram

PostgreSQL10 min

Why PostgreSQL Ignores Your Index