Files

78 lines
1.7 KiB
Markdown

# CI/CD Email Templates
TSX-based email templates for CI/CD pipeline success and failure notifications. The package renders Prettier-formatted HTML for both templates, writes it to disk, and emits readable HTML blocks on stdout for pipeline automation.
## Placeholder
The application name placeholder is always `{{APP_NAME}}`.
Pipeline logic can either:
- replace `{{APP_NAME}}` in the uploaded HTML before sending, or
- set `APP_NAME` when running the renderer to emit app-specific HTML directly.
## Local usage
Build the package:
```bash
pnpm install --frozen-lockfile
pnpm run build
```
Render the templates:
```bash
pnpm start
```
By default this writes:
- `build/html/pipeline-success.html`
- `build/html/pipeline-failure.html`
Override the application name or output directory with environment variables:
```bash
APP_NAME=my-service OUTPUT_DIR=./out pnpm start
```
## Podman lifecycle
Build and run through `podman-compose`:
```bash
podman-compose up --build
```
The rendered HTML files are written to `./build/html` on the host.
Override the rendered app name during compose runs:
```bash
APP_NAME=my-service podman-compose up --build
```
If `APP_NAME` is not set, the renderer falls back to `{{APP_NAME}}`.
## GitHub Actions release
The workflow at `.github/workflows/release.yml`:
1. builds the production container image with Podman
2. runs the renderer to produce HTML files
3. uploads the generated templates to a Cloudflare R2 bucket
The `release` job targets the `Production` GitHub Actions environment.
Required `Production` environment secrets:
- `CF_R2_ACCESS_KEY_ID`
- `CF_R2_SECRET_ACCESS_KEY`
- `CF_R2_ACCOUNT_ID`
- `CF_R2_BUCKET`
Optional `Production` environment variable:
- `CF_R2_PREFIX`