Skip to content

Agent 2: GitHub Actions CI/CD (.github/workflows/) #2

@TomProkop

Description

@TomProkop

Objective

Create 4 GitHub Actions workflow files for CI/CD — infrastructure deployment, container image builds, portal deployment, and PR validation.

Scope

Files to create (ALL in .github/workflows/ — do NOT touch any other directory):

1. .github/workflows/infra.yml — Infrastructure Deployment

  • Triggers: push to main (paths: infra/**), workflow_dispatch with environment input (dev/prod)
  • Auth: OIDC workload identity federation (azure/login with client-id, tenant-id, subscription-id from secrets)
  • Steps: checkout → azure/login → terraform init (backend-config from environment) → terraform plan → terraform apply (only on main, not PRs)
  • PR behavior: terraform plan output posted as PR comment (use actions/github-script)
  • Concurrency: group: terraform-{environment}, cancel-in-progress: false

2. .github/workflows/container-image.yml — Multi-Arch Docker Build

  • Triggers: push to main (paths: Dockerfile, entrypoint.sh, agentbox, tools/**), workflow_dispatch
  • Steps: checkout → docker/setup-buildx-action → docker/setup-qemu-action → docker/login-action (ghcr.io, GITHUB_TOKEN) → docker/build-push-action (platforms: linux/amd64,linux/arm64, tags: latest + sha-{commit})
  • Cache: GitHub Actions cache (type=gha)

3. .github/workflows/portal.yml — Portal Build + Deploy

  • Triggers: push to main (paths: src/portal/**), workflow_dispatch
  • Steps: checkout → setup-dotnet (10.0) → setup-node (22) → npm ci + npm run build (ClientApp) → dotnet restore → dotnet build → dotnet test → dotnet publish → docker build (portal Dockerfile) → push to GHCR → azure/login (OIDC) → az containerapp update
  • Concurrency: portal-deploy

4. .github/workflows/pr-checks.yml — PR Validation

  • Triggers: pull_request to main
  • Jobs (parallel):
    • terraform: init → validate → fmt -check → plan (comment on PR)
    • dotnet: restore → build → test
    • docker: build --no-push (both Dockerfile and portal Dockerfile)

Key Design Decisions

  • OIDC auth everywhere — no stored Azure secrets, workload identity federation
  • GHCR for all images — both agentbox container and portal, using GITHUB_TOKEN
  • Matrix builds not needed yet (single Dockerfile target)
  • Portal workflow installs Node.js for the React frontend build step before dotnet publish
  • All workflows use permissions: id-token: write, contents: read for OIDC

Conflict Prevention

This agent works ONLY in .github/workflows/. No other agent touches this directory.

Acceptance Criteria

  • All 4 YAML files are valid GitHub Actions syntax
  • OIDC auth configured correctly (azure/login@v2)
  • Container image workflow builds linux/amd64 + linux/arm64
  • PR checks run terraform validate + dotnet build + docker build
  • Proper path filters so workflows only trigger on relevant changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions