|
| 1 | +# Releasing |
| 2 | + |
| 3 | +This document describes how governance documents are built, deployed, and released. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The release pipeline is driven by the GitHub Actions workflow |
| 8 | +`.github/workflows/deploy-docs.yml`. It triggers on: |
| 9 | + |
| 10 | +- **Tag push** matching `v*` (e.g. `v0.2`) -- deploys only documents changed |
| 11 | + since the previous tag. |
| 12 | +- **Manual dispatch** (`workflow_dispatch`) -- deploys all documents. |
| 13 | + |
| 14 | +A single workflow run performs four stages in order: |
| 15 | + |
| 16 | +1. Deploy changed documents to WordPress |
| 17 | +2. Translate deployed pages |
| 18 | +3. Build standalone HTML and combined PDF artifacts |
| 19 | +4. Create (or update) a GitHub release with those artifacts |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +The following repository secrets and variables must be configured in GitHub: |
| 24 | + |
| 25 | +| Name | Type | Purpose | |
| 26 | +| :------------------ | :------- | :----------------------------------------------- | |
| 27 | +| `WP_REST_URL` | Variable | Base URL of the WordPress REST API | |
| 28 | +| `WP_APP_USERNAME` | Secret | WordPress application password username | |
| 29 | +| `WP_APP_PASSWORD` | Secret | WordPress application password | |
| 30 | + |
| 31 | +The WordPress site must also expose a custom REST endpoint |
| 32 | +(`cdcf/v1/translate`) that accepts a `source_id` and `target_lang` for the |
| 33 | +translation step. |
| 34 | + |
| 35 | +## How to release |
| 36 | + |
| 37 | +### 1. Prepare the branch |
| 38 | + |
| 39 | +Ensure all changes are merged to `main` and that quality checks pass: |
| 40 | + |
| 41 | +```bash |
| 42 | +npm run lint:md # 0 errors expected |
| 43 | +npm run build:html # standalone HTML files in dist/ |
| 44 | +npm run build:pdf # combined PDF in dist/ |
| 45 | +``` |
| 46 | + |
| 47 | +### 2. Tag and push |
| 48 | + |
| 49 | +```bash |
| 50 | +git tag v0.X |
| 51 | +git push origin v0.X |
| 52 | +``` |
| 53 | + |
| 54 | +This triggers the deploy workflow automatically. |
| 55 | + |
| 56 | +Alternatively, run the workflow manually from the GitHub Actions tab |
| 57 | +(**Run workflow** on the `main` branch). Manual runs deploy all documents and |
| 58 | +auto-increment the version tag. |
| 59 | + |
| 60 | +### 3. What the workflow does |
| 61 | + |
| 62 | +#### Stage 1 -- WordPress deployment |
| 63 | + |
| 64 | +- Compares the tagged commit against the previous tag to determine which |
| 65 | + `.md` files changed. |
| 66 | +- Converts each changed document from Markdown to HTML using `pandoc` with |
| 67 | + the Lua filter `scripts/fix-internal-links.lua` (which rewrites internal |
| 68 | + `.md` links for the target output format). |
| 69 | +- Creates or updates the corresponding WordPress page via the REST API, |
| 70 | + organized under parent pages (`project-governance`, `research`, `standards`). |
| 71 | + |
| 72 | +#### Stage 1b -- Stale page cleanup |
| 73 | + |
| 74 | +- Uses `git diff --diff-filter=D` between tags to detect governance `.md` |
| 75 | + files that were deleted or renamed since the previous release. |
| 76 | +- Derives the WordPress slug for each deleted file (using the same logic as |
| 77 | + deployment) and trashes the corresponding page. |
| 78 | +- If an entire section directory no longer exists (e.g. `ai-governance/` was |
| 79 | + removed), the parent page is also trashed. |
| 80 | +- Pages are moved to the WordPress trash (not permanently deleted), so they |
| 81 | + can be recovered if needed. |
| 82 | +- This step only runs for tag-triggered deploys (not manual dispatch, which |
| 83 | + has no previous tag to compare against). |
| 84 | + |
| 85 | +#### Stage 2 -- Translation |
| 86 | + |
| 87 | +- Each newly deployed page is translated into **it**, **es**, **fr**, **pt**, |
| 88 | + and **de** via the `cdcf/v1/translate` endpoint. |
| 89 | + |
| 90 | +#### Stage 3 -- Build artifacts |
| 91 | + |
| 92 | +- `npm run build:html` (`scripts/build-standalone-html.sh`) -- produces one |
| 93 | + self-contained HTML file per document in `dist/`, each with a navigation |
| 94 | + sidebar linking to the other documents. |
| 95 | +- `npm run build:pdf` (`scripts/build-combined-pdf.sh`) -- concatenates all |
| 96 | + documents into a single Markdown file, converts to standalone HTML, then |
| 97 | + renders a paginated PDF using `pagedjs-cli`. |
| 98 | + |
| 99 | +Both scripts use `scripts/docs-print.css` for styling and |
| 100 | +`scripts/fix-internal-links.lua` for link rewriting. |
| 101 | + |
| 102 | +#### Stage 4 -- GitHub release |
| 103 | + |
| 104 | +- Creates a GitHub release titled **Governance Docs vX.Y** with all |
| 105 | + `dist/*.html` and `dist/*.pdf` files attached. |
| 106 | +- If the release already exists (e.g. re-run), assets are uploaded with |
| 107 | + `--clobber`. |
| 108 | + |
| 109 | +## Local builds |
| 110 | + |
| 111 | +You can build artifacts locally without deploying: |
| 112 | + |
| 113 | +```bash |
| 114 | +npm install # first time only |
| 115 | +npm run build:html # dist/*.html |
| 116 | +npm run build:pdf # dist/cdcf-governance-docs.pdf (requires pagedjs-cli) |
| 117 | +``` |
| 118 | + |
| 119 | +The PDF build requires Google Chrome or Chromium installed locally |
| 120 | +(`pagedjs-cli` uses it for rendering). Set `PUPPETEER_EXECUTABLE_PATH` if |
| 121 | +the binary is not in the default location. |
| 122 | + |
| 123 | +## Document inventory |
| 124 | + |
| 125 | +The following documents are included in builds and deployments: |
| 126 | + |
| 127 | +| Section | File | |
| 128 | +| :----------------- | :----------------------------------------------- | |
| 129 | +| Project Governance | `project-governance/project-vetting-criteria.md` | |
| 130 | +| Project Governance | `project-governance/lifecycle.md` | |
| 131 | +| Project Governance | `project-governance/committees.md` | |
| 132 | +| Project Governance | `project-governance/project-types.md` | |
| 133 | +| Project Governance | `project-governance/definitions.md` | |
| 134 | +| Research | `research/fragmented-catholic-digital-governance.md` | |
| 135 | +| Research | `research/governance-as-code-catholic-technology.md` | |
| 136 | +| Research | `research/trusted-data-infrastructure-catholic-ministry.md` | |
| 137 | +| Standards | `standards/overview.md` | |
| 138 | +| Standards | `standards/committees.md` | |
| 139 | + |
| 140 | +To add a new document, update the `DOCS` array in all three places: |
| 141 | + |
| 142 | +1. `.github/workflows/deploy-docs.yml` (lines 27-38 and 87-98) |
| 143 | +2. `scripts/build-standalone-html.sh` (lines 10-21) |
| 144 | +3. `scripts/build-combined-pdf.sh` (lines 12-24) |
0 commit comments