# GitHub Actions Templates for MORPH-SPEC

> **Framework-Level CI/CD Templates for Coolify/Docker Deployments**

## Overview

Reusable GitHub Actions workflows and composite actions for the **nextjs-neon** stack (Coolify/Docker deployment).

**Key Features:**
- Handlebars v2.0 templating with helpers
- Composite actions for shared logic
- Docker multi-stage builds (.NET API + Next.js Web)
- Coolify deployment via SSH (no MCP/CLI exists — the Coolify API is not publicly exposed, so the runner SSHes into the VPS to trigger it)

---

## Structure

```
infrastructure/github/
├── workflows/
│   ├── dotnet-build.yml.hbs       # .NET restore, build, test, coverage
│   ├── docker-build-push.yml.hbs  # Docker build & push to registry
│   └── deploy-coolify.yml.hbs     # Coolify deployment via SSH
│
└── actions/
    ├── docker-build-push/action.yml.hbs   # Build & push Docker image
    └── health-check/action.yml.hbs        # Poll health endpoint
```

## Workflows

### .NET Build (`dotnet-build.yml.hbs`)
- Restore, build, test with coverage
- Uploads test results and coverage artifacts

### Docker Build & Push (`docker-build-push.yml.hbs`)
- Multi-stage Docker build
- Push to container registry (GHCR or Docker Hub)

### Deploy Coolify (`deploy-coolify.yml.hbs`)
- SSHes into the VPS and calls the local Coolify API (`localhost:8000/api/v1/deploy?uuid=...`) after Docker push
- Runs health check after deployment
- Supports staging + production environments

## Usage

Templates are rendered during `morph-spec init` based on project stack configuration.

```bash
morph-spec init --stack nextjs-neon
```

---

*MORPH-SPEC by Polymorphism Tech*
