Search for a command to run...
Set up GitHub Actions with the current action versions, run your first workflow, configure GitHub-hosted and self-hosted runners and secure your pipelines with OIDC.
GitHub Actions runs your CI/CD pipelines directly from your repository. This guide takes you from an empty repository to a working, secured pipeline using the current action versions and the current runner release.
GitHub Actions runner v2.338.0 · actions/checkout@v7 · actions/setup-node@v7 ·
actions/cache@v6 · actions/upload-artifact@v7 · actions/download-artifact@v8 ·
docker/login-action@v4 · docker/build-push-action@v7 · docker/setup-buildx-action@v4
The runner's own tooling now runs on Node 24, and Node 20 was removed from the hosted
runner images on 23 September 2026. Your workflow still needs actions/setup-node to
install the Node.js version your project targets.
contents: read permission for the workflow (the default for most events)| Concept | What it is |
|---|---|
| Workflow | A YAML file in .github/workflows/ that defines one or more jobs |
| Event | What triggers the workflow — push, pull_request, schedule, workflow_dispatch |
| Job | A set of steps that run on a single runner, optionally in parallel with a matrix |
| Step | One action or shell command inside a job |
| Runner | The machine that executes the job — GitHub-hosted or self-hosted |
Create .github/workflows/ci.yml in your repository:
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: # Adds a "Run workflow" button in the Actions tab
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: '24'
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm testPush the file and watch the run in the Actions tab of your repository.
GitHub provides the virtual machine. Pick an image with runs-on:
runs-on: ubuntu-24.04 # Ubuntu (ubuntu-latest currently resolves to 24.04)
runs-on: windows-latest # Windows Server
runs-on: macos-latest # macOS (Apple silicon on macos-14+)
runs-on: ubuntu-24.04-arm # ARM64 Linux — free for public repositoriesStandard runners give you 2 CPU cores, 7 GB RAM and 14 GB of SSD. They are billed per minute; GitHub-hosted minutes are free for public repositories.
ubuntu-latest moves when GitHub updates it. Pin ubuntu-24.04 in production
pipelines so a base-image change never breaks your build.
actions/setup-node can cache npm, pnpm and Yarn caches for you:
- uses: actions/setup-node@v7
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'For anything else, use actions/cache:
- uses: actions/cache@v6
with:
path: |
~/.cache/pip
~/.cache/uv
key: ${{ runner.os }}-python-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-python-Caching ~/.cache/actions or the tool cache itself slows the job down and can break the
runner. Cache your project dependencies, not the runner.
Set the least-privilege permissions on every workflow
permissions:
contents: readPin third-party actions to a commit SHA
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v7.0.1Tags can be moved to a malicious commit; a SHA cannot.
Use OIDC instead of long-lived cloud credentials
permissions:
id-token: write
contents: read
steps:
- uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::123456789012:role/gha-deployGitHub mints a short-lived token per job — there is no secret to leak or rotate.
Protect the GITHUB_TOKEN — it is a secret that expires with the job and can be
scoped down per workflow.
Sign and attest your builds
- uses: actions/attest-build-provenance@v4
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: sha256:${{ steps.build.outputs.digest }}
push-to-registry: trueScan with CodeQL
- uses: github/codeql-action@v4
with:
languages: javascript-typescriptpermissions explicitly on every workflow — never rely on the default.concurrency to cancel superseded runs and save minutes.GITHUB_TOKEN as a secret — never print it in logs.Set up GitHub Actions, GitLab CI and Jenkins with pipeline examples, runner configuration, caching strategies and deployment automation you can copy straight into your projects.
Configure GitLab CI/CD pipelines with GitLab 19, install and register GitLab Runner 19.5 with the new authentication tokens, and build secure multi-stage pipelines.