Skip to content

Commit 14549e3

Browse files
committed
CI: sync artifact version checks with source metadata
1 parent 1998d2c commit 14549e3

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

.github/scripts/validate-artifacts.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ def ensure_exists(path: Path, label: str) -> None:
5959
print(f"OK [{label}] exists ({path.stat().st_size} bytes)")
6060

6161

62+
63+
64+
def read_markdown_version(path: Path) -> str:
65+
text = path.read_text(encoding="utf-8")
66+
match = re.search(r'(?m)^version:\s*["\']?([^"\'\n]+)["\']?\s*$', text)
67+
if not match:
68+
raise ValidationError(f"Markdown frontmatter version not found: {path}")
69+
version = normalize_text(match.group(1))
70+
if not version:
71+
raise ValidationError(f"Markdown frontmatter version is empty: {path}")
72+
return version
73+
6274
def extract_pdf_text(path: Path) -> str:
6375
try:
6476
result = subprocess.run(
@@ -78,10 +90,10 @@ def extract_pdf_text(path: Path) -> str:
7890
return result.stdout
7991

8092

81-
def validate_pdf(path: Path) -> None:
93+
def validate_pdf(path: Path, expected_version: str) -> None:
8294
ensure_exists(path, "PDF")
8395
text = extract_pdf_text(path)
84-
assert_contains(text, (FULL_TITLE, SHORT_TITLE, "Version 3.1", *CANONICAL_TOKENS), "PDF")
96+
assert_contains(text, (FULL_TITLE, SHORT_TITLE, f"Version {expected_version}", *CANONICAL_TOKENS), "PDF")
8597
print("OK [PDF] canonical text markers found")
8698
return text
8799

@@ -179,9 +191,11 @@ def parse_args() -> argparse.Namespace:
179191
def main() -> int:
180192
args = parse_args()
181193
try:
194+
markdown_path = Path(args.markdown)
195+
expected_version = read_markdown_version(markdown_path)
182196
texts = {
183-
"Markdown": validate_markdown(Path(args.markdown)),
184-
"PDF": validate_pdf(Path(args.pdf)),
197+
"Markdown": validate_markdown(markdown_path),
198+
"PDF": validate_pdf(Path(args.pdf), expected_version),
185199
"EPUB": validate_epub(Path(args.epub)),
186200
"DOCX": validate_docx(Path(args.docx)),
187201
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to the WordPress Operations Runbook template.
1212
- Added Learn WordPress's [Writing in the WordPress voice](https://learn.wordpress.org/course/writing-in-the-wordpress-voice/) as the recommended WordPress-specific voice and accessibility reference when runbook material is adapted into user-facing or cross-team communications.
1313

1414
### Changed
15+
- Made the generated-artifact validator read the expected version string from the Markdown frontmatter instead of hardcoding `Version 3.1`, preventing future publish-flow failures after routine version bumps.
1516
- Updated Section 1.4 of the canonical runbook so the in-document version history matches the actual template release history (`3.1`, `3.0.1`, `3.0`, `2.0`) instead of stale placeholder entries.
1617
- Separated Playwright PDF visual validation from the artifact publish path so `generate-docs.yml` can publish after artifact checks while the dedicated visual workflow handles layout regression checks on workflow, packaging, and Pandoc changes.
1718
- Aligned more of the operational procedures with the current runbook-skill safety rules by normalizing the cache-plugin annotation string, correcting the remaining singular `--field` WP-CLI examples to explicit `--fields=... --format=csv` pipelines, and adding approval/warning markers around additional side-effect commands (`wp db query` migrations, cache flushes, imports, option updates, transient deletion, and `wp eval-file` test mail).

0 commit comments

Comments
 (0)