RousselTMLEARNING

TP · GitHub Actions: from discovery to expertise

Lab: GHCR image, self-hosted runner and environments

What you will learn in this TP
  • Publish an image with GITHUB_TOKEN
  • Install a self-hosted runner
  • Deploy to environments
  • Require approval before production
Mode :

All steps and instructions are shown. Recommended for this lab: semi-guided

Introduction #

Context. The shop must be delivered automatically to staging and production, but production is only deployed after the manager agrees.

Prerequisites: a free GitHub account, Git, Python 3 and the gh CLI, Docker, the Lab 1 repository (public)  ·  Estimated time: 50 min

One image per commit in GHCR, a local runner, two environments with mandatory approval for production.

Setup #

Guided steps, with their solution.

  1. 1. Install the runner

    Why? A runner on your machine can start containers locally, like a staging server.

    Download runner 2.338.2, register it with the local label and start it.
  2. 2. Create the environments

    Why? Approval is held by the environment: no job can bypass it.

    Create the recette and production environments; add yourself as a required reviewer of production and restrict it to the main branch.
  3. 3. Write the delivery workflow

    Why? The same image identifier travels through environments: what is tested in staging is what goes to production.

    Create .github/workflows/livraison.yml (GHCR build and push on a hosted runner, deployments on the local runner), push and approve production from the run page.
  4. 4. Clean up

    Why? A forgotten runner stays an open door to your machine.

    Stop the containers, then unregister and remove the runner.

Validate your work

Check that each goal above is reached and that you get the result described in the introduction.

Difficulty level : ●●●○○ (3/5)

My progress

  • ⏱ Estimated time : ≈ 50 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

GitHub Actions runners: hosted, self-hosted and ARC

Choosing where workflows run: hosted runners and images, larger runners, self-hosted runners (ins...

Delivering with GitHub Actions: GHCR, environments, OIDC and attestations

Building and deploying with GitHub Actions: publishing an image to GitHub Container Registry with...

Container registry: choosing and securing your image registry (Docker Hub, Harbor, GHCR, ECR)

Understand container registries: Docker Hub, GitHub Container Registry, cloud registries (ECR, AC...

End-to-end CI/CD (5/5): GitHub Actions, GitLab CI, Jenkins and Argo CD in practice

Compare and use CI/CD tools: GitHub Actions, GitLab CI, Jenkins, Argo CD and Flux; a complete pip...

GitHub Actions: concepts and how it works

Discover GitHub Actions: events, workflows, jobs, steps and actions, the Marketplace, hosted runn...

End-to-end CI/CD (3/5): artifacts, registries and environments

Deliver continuously: immutable, versioned artifacts, image and package registries, promoting the...

Arize in production: self-hosted Phoenix, Arize AX, security, costs and monitoring

Going to production: Phoenix with PostgreSQL and authentication, an OpenTelemetry Collector in fr...

Azure Pipelines agents: hosted, self-hosted and managed pools

Choosing and running Azure Pipelines agents: Microsoft-hosted agents and images, self-hosted agen...

End-to-end CI/CD (1/5): principles and anatomy of a pipeline

Understand end-to-end CI/CD: continuous integration, continuous delivery and continuous deploymen...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!