RousselTMLEARNING

Article · GitHub Actions: from discovery to expertise

Delivering

1. Building and publishing #

An image traced back to its commit.

The workflow #

From build to production
jobs:
  image:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
      attestations: write
      id-token: write
    steps:
      - uses: actions/checkout@v7
      - uses: docker/login-action@v4
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - id: meta
        uses: docker/metadata-action@v6
        with:
          images: ghcr.io/${{ github.repository }}
          tags: type=sha
      - id: push
        uses: docker/build-push-action@v7
        with:
          push: true
          tags: ${{ steps.meta.outputs.tags }}
      - uses: actions/attest-build-provenance@v4
        with:
          subject-name: ghcr.io/${{ github.repository }}
          subject-digest: ${{ steps.push.outputs.digest }}
          push-to-registry: true
  production:
    needs: image
    runs-on: ubuntu-latest
    environment:
      name: production
      url: https://boutique.exemple.fr
    permissions:
      id-token: write
      contents: read
    steps:
      - uses: aws-actions/configure-aws-credentials@v5
        with:
          role-to-assume: arn:aws:iam::123456789012:role/shop-deployment
          aws-region: eu-west-3
      - run: ./deploy.sh ${{ needs.image.outputs.tag }}
  • GITHUB_TOKEN is a temporary token created for each run; its rights are set with permissions (here, writing packages).
  • A signed provenance attestation proves which workflow, on which commit, produced the image; it is verified with gh attestation verify.

2. Environments and OIDC #

Controlling who deploys and with which rights.

Environments #

Protection ruleEffect
Required reviewersthe job waits for approval from a designated person or team
Wait timerpause before deployment (1 to 43,200 minutes)
Deployment branchesonly some branches or tags can target the environment
Environment secretsonly available to jobs of that environment, after approval

With id-token: write, the job gets a GitHub-signed OIDC token that the cloud exchanges for temporary rights. The trust relationship specifies the repository and environment (repo:org/repo:environment:production): no key to store.

Best practice : Put production secrets in the production environment, never at repository level: they are then only exposed after approval.

Commands to know #

Commands to know
  • gh attestation verify oci://ghcr.io/org/boutique:sha-abc1234 --owner org : verify an image's provenance
  • gh run list --workflow deploy.yml : deployment history
  • gh release create v1.2.0 --generate-notes : create a release

Sources #

Checked in November 2026: CI/CD platforms change every month, check versions and plans in the vendor's documentation.

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

My progress

  • ⏱ Estimated time : ≈ 7 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

Building and delivering with GitLab: registry, environments and deployments

Delivering with GitLab CI/CD: building and publishing images to the project registry, package reg...

GitHub Actions runners: hosted, self-hosted and ARC

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

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...

Reusing and securing GitHub Actions workflows

Industrializing GitHub Actions: reusable workflows, composite, JavaScript and Docker actions, lea...

Writing GitHub Actions workflows

Mastering workflow syntax: triggers and filters, jobs and needs, matrices, if conditions, context...

GitHub Actions best practices and troubleshooting

Running GitHub Actions: speeding up and cutting costs, debugging (debug logs, act locally, gh run...

Deploying with Azure Pipelines: environments, approvals and service connections

Delivering with Azure Pipelines: multi-stage pipelines, environments, approvals and checks, deplo...

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...

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!