v1.31.0
guíaPatrón · 08_CICDenglishversión en español

CI/CD guide with GitHub Actions — phases 0, 1 and 2, commands and security

6 minlectura
1339palabras
8secciones
2026-10-02última edición
2cambios

Audience: developers and project managers whose repository lives on GitHub (ecosystem.config.json → cicd.platform: github-actions). This is the equivalent reading to GUIA_COMPLETA_CICD.md + GUIA_FASES_ADOPCION.md, which follow the Azure DevOps case. The phases, the commands and the invariants are the same; what changes is what you need from the platform and the shape of the files. Generated by Ovillo.


1. The general idea

With /hv:cicd-init, Ovillo generates one pipeline per deployable entrypoint (R25) under .github/workflows/, with the on-demand model (G1): a push to the base branch builds and tests; the deployment to dev/pre/pro is requested with /hv:cicd-deploy (or Actions → Run workflow). "Releasing" (/hv:cicd-release) means tagging a semver version, building it and creating the GitHub Release; it does not deploy.

CommandWhat it does on GitHubWhen
/hv:cicd-initGenerates ci.yml (phase 1) or cd-<slug>.yml + a reusable workflow + composite actions (phase 2); creates environments and secrets with gh; records it in the Hilo and in the HubWhen adopting CI/CD or promoting a phase
/hv:cicd-statusRuns (gh run list/view), time per job, last deployment per environment, runs waiting for approval, template driftTo see how the pipeline is doing
/hv:cicd-releaseAnnotated tag + push (triggers build) + gh release create --generate-notesWhen marking a version
/hv:cicd-deploy`gh workflow run cd-<slug>.yml --ref <branch\tag> -f environment=<env>` and follows the runWhen promoting an artifact to an environment

2. What you need in each phase

Phase 0 (manual deploy)Phase 1 (build validation)Phase 2 (full CD)
Repository on GitHub✅✅✅
gh authenticated (gh auth login)❌✅ (for rulesets and checks over the API)✅ (environments, secrets)
Runner❌hosted (ubuntu-latest/windows-latest) or self-hostedthe same; deploying to on-premise IIS requires a self-hosted runner with access to the server
Base-branch ruleset with the Build/Security checksrecommended✅ (git-best-practices)✅
Environments dev/pre/pro❌❌✅; reviewers on pre/pro only on public repositories or Team/Enterprise plans (on Free private, the gate is the workflow_dispatch itself)
Secrets per environment❌❌✅ (gh secret set <KEY> --env <env>)
Cloud identity❌❌OIDC (id-token: write + a federated credential) if the target is Azure/AWS; credentials only if there is no alternative (G18)
Ovillo Hub (quality record)❌❌optional: secret HUB_SERVICE_KEY + variable HUB_PROJECT_ID

There is no pool to authorize and no agents to install (unless self-hosted): what on Azure was a handoff to the infrastructure team is here admin permission on the repository (environments, secrets, rulesets) and, for Projects v2 and organization runners, organization owner (see PERMISOS_CICD.md § GitHub).

3. What /hv:cicd-init generates

Phase / stackFilesNotes
Phase 1 .NET.github/workflows/ci.ymljobs Build (restore/build/test/coverage) and Security (dotnet list package --vulnerable, fails on Critical/High). These are the checks the ruleset requires. In phase 2 it loses the push trigger and stays for PRs and the merge queue
Phase 2 .NET.github/workflows/cd-<slug>.yml · _reusable-dotnet-build.yml · .github/actions/{security-scan,security-gate,quality-sync}one cd-*.yml per entrypoint; a reusable build; jobs deploy-dev/pre/pro with environment: and if: workflow_dispatch && inputs.environment == '<env>'
Vue 3 + Vitecd-<slug>.ymlnpm ci + lint + test + build; best-effort smoke
.NET tool / librarypublish-nuget.ymla v* tag publishes the .nupkg (GitHub Packages or NuGet.org)
Opt-in securitysecurity.ymlCodeQL + dependency review; only if the repository is public or has GHAS (§ 6)
Scripts in the repositoryops/cicd/scripts/security-scan.ps1, Sync-QualityRecord.ps1CI cannot read the plugin: /hv:cicd-init copies them
Documentationops/cicd/RUNBOOK.md, PERMISOS_CICD.md, SEGURIDAD_PIPELINE.mdadapted to the project

Every workflow carries the stamp # Ovillo cicd-architect github-<stack> @ …; /hv:cicd-status warns about drift when the template changes, and /hv:cicd-init option 4 re-renders it.

4. Deployment model and rollback

  • On-demand (default): deploy-<env> only runs with workflow_dispatch and inputs.environment == '<env>'.
  • Auto: deploy-dev with if: github.event_name == 'push'; pre/pro stay on-demand.
  • Branch-gated (gitlab-flow/gitflow): plus github.ref == 'refs/heads/<the environment's branch>'.
  • Double gate on pre/pro: the confirmation in /hv:cicd-deploy and the environment's required reviewers. Nobody approves their own environment from Ovillo: approval happens in Actions → Review deployments.
  • Rollback (G9): (1) the backup taken in the Deploy step; (2) redeploy the previous version: /hv:cicd-deploy --env <env> --tag <previous> (= gh workflow run cd-<slug>.yml --ref <tag> -f environment=<env>); (3) by hand, following ops/cicd/RUNBOOK.md.

5. Invariants the workflow satisfies out of the box (G15-G19)

RuleIn the generated YAML
G15Least privilegepermissions: contents: read at the root; each job raises only what it uses (id-token: write in deploy, security-events: write in CodeQL)
G16Actions pinned by SHAuses: owner/action@<sha40> # vX.Y.Z; Dependabot keeps them current (git-best-practices/templates/dependabot.yml.template)
G17No pull_request_target with a checkout of the fork, and no ${{ github.event.* }} inside run:inputs through env: and "$VAR"
G18OIDCid-token: write + azure/login/configure-aws-credentials with a federated credential
G19concurrencycancel-in-progress: true in CI, false in CD

Audit it with the github-actions-reviewer agent (see AUDITAR_PIPELINE.md); the ecosystem team maintains a linter with the same criteria.

6. Repository security (opt-in, with graceful degradation)

FeatureCostHow /hv:cicd-init turns it on (PHASE 2.5-gh)If it is not available
Dependabot alertsfreegh api -X PUT repos/{o}/{r}/vulnerability-alerts—
Dependabot security updatesfreegh api -X PUT repos/{o}/{r}/automated-security-fixes—
Dependabot version updatesfree.github/dependabot.yml (git-best-practices)—
Dependency review on PRsfree (dependency graph)the dependency-review job of security.yml—
Secret scanning + push protectionfree on public repos; GHAS on privategh api -X PATCH repos/{o}/{r} --input security.json (security_and_analysis)Ovillo's secret-scanner hook + G5 (secrets only through secrets.*)
Code scanning (CodeQL)free on public repos; GHAS (Code Security) on privatesecurity.yml (advanced setup, SHA-pinned) or gh api -X PATCH repos/{o}/{r}/code-scanning/default-setup -f state=configuredthe G8 gate (security-scan.ps1: dependencies, secrets, hardening, CA5xxx SAST) + the Security job of ci.yml

The rule: /hv:cicd-init tries the call and branches on the status code, not on the error text. Measured against a private repository without GHAS: secret scanning returns 422 "Secret scanning is not available for this repository" and code scanning 403 "Code scanning is not enabled for this repository"; Dependabot (alerts and security updates) returns 204 and works. On a 403 or a 422 it does not materialize security.yml, records it in ops/cicd/SEGURIDAD_PIPELINE.md and carries on. It never blocks adoption over a licence.

7. Quality: publishing the quality record to the Hub

The quality job of cd-<slug>.yml (the quality-sync composite) publishes each build's quality record to the Ovillo Hub. It needs the secret HUB_SERVICE_KEY (the project's service key, not a developer's apiKey) and the variable HUB_PROJECT_ID. Two ways:

  • Zero-touch: /hv:cicd-init PHASE 2.7 materializes and runs ops/cicd/provision-quality-ci-key.ps1 (from Provision-QualityCiKey.github.ps1.template): it asks the Hub for the key and stores it with gh secret set over stdin. The key is never printed.
  • By hand: the admin issues it (EXEC mcp.EmitirServiceKey @Label='ci-quality') and gh secret set HUB_SERVICE_KEY < key.txt.

Without the key, the job warns and exits green: quality does not gate the build.

8. Troubleshooting

SymptomCauseFix
gh workflow run: Workflow does not have 'workflow_dispatch' trigger, or a 404The file is not on the default branch, or it has no such triggerMerge cd-<slug>.yml into main; /hv:cicd-init option 4
The run stays in waitingAn environment with reviewersA reviewer approves it in Actions → Review deployments
No deploy-* job runs after the dispatchinputs.environment does not match the if: conditions; branch-gated with a --ref from another branchCheck options: [dev, pre, pro]; use the environment's branch
Resource not accessible by integrationThe gh token lacks the workflow scope, or Actions are disabledgh auth refresh -s workflow; Settings → Actions
The ruleset does not require the checksThe check name ≠ the job's name: (Build, Security)Align required_status_checks.contexts with the job names
CodeQL fails in analyzeA private repository without GHASRemove security.yml; G8 + Dependabot remain
The quality record is not publishedHUB_SERVICE_KEY or HUB_PROJECT_ID is missing§ 7
/hv:cicd-status reports driftThe stack's template changed/hv:cicd-init option 4 (re-render + self-check -GitHub)

Ovillo guide — CI/CD with GitHub Actions. For the Azure DevOps case: GUIA_COMPLETA_CICD.md, GUIA_FASES_ADOPCION.md.

Fuente: ovillo/_patron/08_CICD/GUIA_GITHUB_ACTIONS_EN.md

Ovillo v1.31.0tag v1.31.0 (2026-10-06) · sin decisiones posteriores69 skills · 19 agents · 22 hooks · 3 reglas · 15 tools · 103 decisionesfuente: ovillo/_patron/08_CICD/GUIA_GITHUB_ACTIONS_EN.mdCopyright 2026 Hugo Valer Rojas · Apache-2.0