GitHub Actions Workflows: From Commit to Cloud

An approximately five-minute guide to pipelines, container deployments, and choosing the right runners.

Introduction

A developer merges a change. An image builds, a registry receives it, and a cloud application deploys the new version—without anyone copying commands into a terminal.

That is a typical use of GitHub Actions: automation defined alongside your code. It supports continuous integration and delivery (CI/CD), plus tasks such as scheduled maintenance and repository housekeeping.1

How workflows work

A workflow is a YAML definition stored in your repository’s GitHub workflows directory. Its building blocks are:

  • Events: Triggers such as a push, pull request, schedule, or manual request.
  • Jobs: Groups of work, such as testing or deploying.
  • Runners: The machines or execution environments that run jobs.
  • Steps: Commands or reusable actions executed within a job.

Jobs can run in parallel unless dependencies are declared with needs. Steps normally execute sequentially on the same runner. Separate jobs should not assume they share a local filesystem; explicitly transfer outputs or artifacts.12

Think of the workflow as the recipe and the runner as the kitchen. Changing kitchens does not fundamentally change what the recipe describes.

Different types of pipelines

These are common design patterns, not separate GitHub product modes:

Pipeline pattern What it does Example
Continuous integration (CI) Builds and validates changes Test every pull request before merging
Continuous delivery Prepares a deployable release, with a human release decision Build an image, then require production approval
Continuous deployment Automatically releases changes that pass the checks Deploy every successful main-branch build
Scheduled or manual automation Runs independently of a new commit Nightly dependency checks or an on-demand deployment

GitHub supports event, schedule, and manual triggers. Deployment environments can introduce approval gates, although feature availability depends on the repository visibility and GitHub plan.13

Example: Build a container and deploy it to Azure

Imagine a small API deployed to Azure Container Apps, with images stored in Azure Container Registry (ACR). The workflow below checks out the source, authenticates, builds and pushes an image, and updates an existing application.4

Configure these prerequisites first

  • A repository containing a working Dockerfile.
  • An existing ACR registry and Container App, with the correct application port configured.
  • An Azure identity federated with GitHub through OpenID Connect (OIDC), restricted to this repository’s main branch.
  • Scoped Azure permissions allowing that identity to push images and update the app.
  • A separate runtime identity for the Container App, authorized and configured to pull images from ACR.
  • Repository variables matching the vars.* names below. Set ACR_NAME to the registry’s short name and ACR_LOGIN_SERVER to its actual login server.

OIDC avoids storing a long-lived Azure client secret in GitHub. The deployment identity and the application’s image-pull identity serve different purposes; configuring one does not configure the other.45

name: Build and deploy API on: push: branches: [main] permissions: contents: read id-token: write concurrency: group: api-production cancel-in-progress: false jobs: deploy: runs-on: ubuntu-latest timeout-minutes: 20 env: ACR_NAME: ${{ vars.ACR_NAME }} ACR_LOGIN_SERVER: ${{ vars.ACR_LOGIN_SERVER }} RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }} APP_NAME: ${{ vars.CONTAINER_APP_NAME }} steps: - name: Check out source uses: actions/checkout@v7 with: persist-credentials: false # Insert application-specific tests before publishing.  - name: Sign in to Azure using OIDC uses: azure/login@v3 with: client-id: ${{ vars.AZURE_CLIENT_ID }} tenant-id: ${{ vars.AZURE_TENANT_ID }} subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} - name: Build and push image shell: bash run: | set -euo pipefail az acr login --name "$ACR_NAME" IMAGE="$ACR_LOGIN_SERVER/demo-api:$GITHUB_SHA" docker build --tag "$IMAGE" . docker push "$IMAGE" echo "IMAGE=$IMAGE" >> "$GITHUB_ENV" - name: Deploy image shell: bash run: | set -euo pipefail az extension add --name containerapp --upgrade az containerapp update \ --name "$APP_NAME" \ --resource-group "$RESOURCE_GROUP" \ --image "$IMAGE" 

The image tag identifies the source commit; it is more traceable than repeatedly deploying latest, but tags can still be overwritten. For stronger artifact identity, deploy by image digest. Updating the image creates a Container Apps revision; traffic behavior depends on the app’s revision configuration.46

This is a deployment skeleton, not a complete production pipeline. Add tests, image scanning, health verification, and a rollback procedure. For controlled releases, separate build and deployment jobs, promote the same image, and protect the deployment environment. Major action tags keep this example readable; pin reviewed full-length commit SHAs and maintain those pins for production.378

Managed versus self-hosted runners

GitHub-hosted runners are managed by GitHub. Self-hosted runners run on infrastructure your team manages—even when that infrastructure is rented from a cloud provider.910

Option Advantages Disadvantages Prefer it when…
GitHub-hosted Quick setup; GitHub maintains runner machines; standard OS options Less infrastructure control; usage costs and networking requirements need review Standard builds and tests need minimal operational effort
Self-hosted Custom hardware, tools, and network placement Your team owns host security, capacity, cleanup, and maintenance Private dependencies, specialist hardware, or organizational controls require it

Recommendation: Start with hosted runners unless a concrete requirement justifies self-hosting. Compare total operating cost—not just compute prices. Self-hosting also requires isolating untrusted code; GitHub warns against using self-hosted runners for public-repository pull requests.7910

ARC versus VM runners: Which should you choose?

Here, ARC means Actions Runner Controller, not Azure Arc. It manages autoscaling self-hosted runners on Kubernetes. ARC and VMs are not exact opposites: Kubernetes nodes themselves may be VMs.11

Approach Advantages Disadvantages Best fit
Self-hosted VM runners Straightforward starting point; flexible OS and installed tools Persistent machines can retain job state; ephemeral provisioning and scaling need automation A small runner fleet, Windows workloads, or specialized tooling
ARC on Kubernetes Autoscaling runner pods; disposable execution environments Requires Kubernetes expertise, cluster operations, and a suitable image-building setup Bursty Linux workloads on an already-supported Kubernetes platform

GitHub recommends ARC for Kubernetes-based runner autoscaling. That is not a recommendation to introduce Kubernetes solely for a few builds. Prefer disposable, single-job runners where practical, including VM-based designs. If using ARC’s Docker-in-Docker mode, account for its privileged-container requirement.111213

Two practical scenarios

  • Small API team: Start with GitHub-hosted runners and the container workflow above. Avoid operating a cluster just to run occasional builds.
  • Enterprise platform team: Consider ARC for many bursty Linux builds if Kubernetes operations already exist. Keep specialist Windows builds on a separate VM pool.

These are starting recommendations, not universal performance or cost guarantees.

Alternative: Keep an existing CI platform

Jenkins remains an option when an organization already depends on its controller-and-agent model. The advantage is preserving established integrations and infrastructure; the disadvantage is retaining responsibility for controller, agent, and plugin administration. Moving to GitHub Actions should solve a real problem—not simply replace working YAML or scripts.14

Conclusion

Choose pipeline behavior and runner infrastructure separately. Decide what validates and releases your application, then select the simplest execution environment that satisfies its requirements.

For a typical new service, the practical starting point is GitHub-hosted runners, OIDC authentication, and a traceable container image. Move to self-hosted VMs for specific infrastructure needs, or ARC when Kubernetes-based scale genuinely earns its operational complexity.

Sources

Official documentation consulted for this article:

  1. GitHub Docs — Understanding GitHub Actions. ↩

  2. GitHub Docs — Workflows and Understanding GitHub Actions, job execution and dependencies. ↩

  3. GitHub Docs — Managing environments for deployment and Reviewing deployments. ↩

  4. Microsoft Learn — Publish revisions with GitHub Actions in Azure Container Apps. ↩

  5. Azure/login official repository — README, supported versions and OIDC configuration. ↩

  6. Microsoft Learn — Azure CLI reference, az containerapp update. ↩

  7. GitHub Docs — Secure use reference. ↩

  8. actions/checkout official repository — README and releases; Azure/login official README. ↩

  9. GitHub Docs — GitHub-hosted runners. ↩

  10. GitHub Docs — Self-hosted runners and Self-hosted runners reference. ↩

  11. GitHub Docs — Actions Runner Controller. ↩

  12. GitHub Docs — Deploying runner scale sets with Actions Runner Controller. ↩

  13. GitHub Docs — Self-hosted runners reference, autoscaling and ephemeral runners. ↩

  14. Jenkins Documentation — Using Jenkins agents, Managing Nodes, and Managing Jenkins. ↩