Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions .devcontainer/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions .devcontainer/devcontainer.json

This file was deleted.

68 changes: 68 additions & 0 deletions .github/actions/build-site/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build documentation site
description: Generate API markdown with DocFX, then statically generate the Nuxt site

inputs:
node-version:
description: Node.js version
required: false
default: '22'
dotnet-version:
description: .NET SDK version
required: false
default: '8.0.x'

runs:
using: composite
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Install DocFX
shell: bash
run: |
dotnet tool install -g docfx
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"

- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ inputs.node-version }}
cache: npm
cache-dependency-path: site/package-lock.json

- name: Cache NuGet packages for API generation
uses: actions/cache@v6
with:
path: api-gen/packages-cache
key: api-nuget-${{ hashFiles('api-gen/packages.json') }}
restore-keys: |
api-nuget-

- name: Generate API markdown
shell: bash
run: node api-gen/run.mjs prepare

- name: Install site dependencies
shell: bash
run: npm ci
working-directory: site

- name: Generate static site
shell: bash
run: npm run generate
working-directory: site

- name: Ensure CNAME in site output
shell: bash
run: |
mkdir -p site/.output/public
if [ -f site/public/CNAME ]; then
cp site/public/CNAME site/.output/public/CNAME
elif [ -f CNAME ]; then
cp CNAME site/.output/public/CNAME
else
echo "Missing CNAME for GitHub Pages custom domain" >&2
exit 1
fi
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
pull_request:
branches:
- master

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Build site
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Build documentation site
uses: ./.github/actions/build-site
47 changes: 47 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy

on:
push:
branches:
- master
workflow_dispatch:

concurrency:
group: pages
cancel-in-progress: false

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
name: Build site
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Setup Pages
uses: actions/configure-pages@v6

- name: Build documentation site
uses: ./.github/actions/build-site

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: site/.output/public

deploy:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v5
30 changes: 27 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
_site
.sass-cache
.jekyll-metadata
###############
# API generator
###############
api-gen/repos/
api-gen/packages-cache/
api-gen/out/
api-gen/docfx.json

###############
# Nuxt site
###############
site/node_modules/
site/.nuxt/
site/.output/
site/dist/
site/.data/
site/public/api-markdown/
site/public/api-meta/
site/public/api-catalog.json

###############
# OS / IDE
###############
node_modules/
*.swp
.vs/
.DS_Store
*.log
2 changes: 1 addition & 1 deletion CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
autofixture.com
autofixture.com
119 changes: 119 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Deployment runbook

How we build and publish https://autofixture.com from this repo using **GitHub Pages + GitHub Actions** (Option A).

## Architecture (short)

| Stage | What happens |
|-------|----------------|
| API gen | `node api-gen/run.mjs prepare` downloads pinned NuGet packages, runs DocFX, writes markdown + meta into `site/public/` (not committed) |
| Site | `npm run generate` in `site/` prerenders docs + API routes to `site/.output/public` |
| Host | `actions/upload-pages-artifact` + `actions/deploy-pages` publish that folder |

Custom domain: `site/public/CNAME` → `autofixture.com` (must be in the uploaded artifact root).

## Workflows

| Workflow | File | When | Purpose |
|----------|------|------|---------|
| **CI** | `.github/workflows/ci.yml` | Pull requests to `master` | Same build as production; no deploy |
| **Deploy** | `.github/workflows/deploy.yml` | Push to `master`, or manual `workflow_dispatch` | Build + publish to Pages |

Shared build steps live in `.github/actions/build-site/`.

## One-time repo setup

Do this once (org admin / repo admin):

1. Open **Settings → Pages**.
2. Under **Build and deployment → Source**, choose **GitHub Actions** (not “Deploy from a branch”).
3. Confirm custom domain is **`autofixture.com`** (already set in Pages; keep `CNAME` files in sync).
4. After the first successful Actions deploy and DNS is correct, enable **Enforce HTTPS**.
5. Optional: under **Environments → github-pages**, require reviewers if you want a human gate before production publishes.

No deploy secrets are required for public NuGet + public Pages.

## Everyday deploy

1. Open a PR → **CI** must pass (build only).
2. Merge to **`master`** → **Deploy** runs automatically.
3. Check the Actions run, then open https://autofixture.com (or the `page_url` from the deploy job).

Manual republish (same commit, no code change):

```bash
gh workflow run Deploy --repo AutoFixture/AutoFixture.github.io
```

Or: Actions → **Deploy** → **Run workflow**.

## Local parity

Approximate what CI does:

```bash
# Needs: Node 22+, .NET SDK 8+, DocFX (`dotnet tool install -g docfx`)
node api-gen/run.mjs prepare
npm ci --prefix site
npm run generate --prefix site
# Static output: site/.output/public
```

Or with just:

```bash
just prepare-api
just site-install
just site-generate
```

Preview the static output:

```bash
npx --prefix site serve site/.output/public
```

## Rollback

GitHub Pages keeps recent deployments. Options:

1. **Re-run** a previous successful **Deploy** workflow run (Actions → that run → Re-run all jobs), if the commit still matches what you want.
2. **Revert** the bad commit on `master` and push (triggers a new good deploy).
3. Checkout an older commit and use **workflow_dispatch** only if you temporarily point the workflow at that ref (prefer revert for clarity).

## Updating API package versions

Versions are pinned in `api-gen/packages.json`. To refresh API docs after a NuGet release:

1. Edit versions in `api-gen/packages.json`.
2. Run `node api-gen/run.mjs prepare` locally and spot-check.
3. PR → merge → Deploy regenerates API in CI (no generated files in git).

## DNS / domain notes

- **Canonical:** `autofixture.com` → GitHub Pages (`A`/`AAAA` + `www` CNAME to `autofixture.github.io`).
- **Aliases:** `autofixture.io`, `.net`, `.org` → permanent redirect to `https://autofixture.com/` (Namecheap URL Redirect is HTTP-only; HTTPS redirects planned via Cloudflare DNS later).
- One custom domain per Pages site. Keep both `CNAME` (repo root) and `site/public/CNAME` equal to `autofixture.com` so Actions deploys do not overwrite Pages back to an old domain.

## Troubleshooting

| Symptom | Likely cause | What to try |
|---------|--------------|-------------|
| Deploy fails: Pages source | Still on “Deploy from a branch” | Switch Source to **GitHub Actions** |
| 403 on deploy | Missing `pages: write` / `id-token: write` | Check `deploy.yml` permissions |
| Missing / wrong domain | `CNAME` not in artifact or still `.io` | Ensure `site/public/CNAME` is `autofixture.com` |
| DocFX not found | Tool not on PATH | Composite action installs DocFX and adds `~/.dotnet/tools` |
| Slow builds | Cold NuGet cache | Wait for `api-gen/packages-cache` cache hit on next run |
| API page empty after client nav | Server route not available on static host | Prefer full page load / prerendered routes; open an issue if a route was not prerendered |
| HTTPS cert pending | New custom domain | Wait for Let’s Encrypt; then Enforce HTTPS |

## Go-live checklist (first Actions deploy)

- [ ] Pages source set to **GitHub Actions**
- [ ] Pages custom domain is **`autofixture.com`** + Enforce HTTPS
- [ ] `CNAME` and `site/public/CNAME` are `autofixture.com`
- [ ] PR CI green on a test PR
- [ ] Merge to `master` (or `workflow_dispatch`) succeeds
- [ ] https://autofixture.com serves the Nuxt site (not the old Jekyll site)
- [ ] Spot-check `/docs/...` and a few `/api/...` deep links
- [ ] Confirm `.io` / `.net` / `.org` redirect to `.com` (HTTPS via Cloudflare later if needed)
Loading