forked from virgiliojr94/book-to-skill
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (72 loc) · 3.44 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
75 lines (72 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Deploy docs
on:
push:
branches: [master]
paths:
- docs/**
- overrides/**
- README.md
- SKILL.md
- BACKERS.md
- mkdocs.yml
- .github/workflows/deploy-docs.yml
pull_request:
paths:
- docs/**
- overrides/**
- README.md
- SKILL.md
- BACKERS.md
- mkdocs.yml
- .github/workflows/deploy-docs.yml
# Minimal: gh-deploy pushes the built site to the gh-pages branch.
permissions:
contents: write
jobs:
docs:
runs-on: ubuntu-latest
steps:
# Actions pinned to commit SHAs (tags in comments) so a supply-chain
# swap on a moving tag cannot alter the build. Zizmor-clean.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Install MkDocs Material
run: pip install mkdocs-material mkdocs-redirects
- name: Assemble docs sources
# Single-source: the Guide and Skill Reference pages are the repo-root
# README.md / SKILL.md, copied in (never committed under docs/). The
# landing page docs/index.md is committed and curated separately.
#
# README links are written repo-relative (`docs/faq.md`, `docs/assets/…`)
# so they work on GitHub. Once the file lands *inside* docs/ they must
# drop that prefix, otherwise every one of them 404s on the site.
run: |
# README.md carries no frontmatter (it has to stay clean on GitHub), so
# the Guide page would otherwise inherit the generic site description.
{
printf -- '---\n'
printf -- 'description: "Convert a book, PDF, EPUB or DOCX into an agent skill for Claude Code, GitHub Copilot CLI and Amp. Install, run, and cut token cost 24x-51x."\n'
printf -- 'seo_title: "book-to-skill Guide - Convert Any Book Into an Agent Skill"\n'
printf -- '---\n\n'
# `width="100%"` is what GitHub wants, but it is not a valid HTML
# width, so browsers discard it and reserve no space for the banner —
# everything below it jumps once the image loads. Real dimensions let
# the browser hold the slot; Material's `height:auto` keeps it fluid.
sed -E 's,(href="|src="|\]\()docs/,\1,g' README.md \
| sed -E '/banner\.webp/s,width="100%",width="1600" height="686",'
} > docs/guide.md
# SKILL.md's `description` is written for host agents (~400 chars); as a
# meta description it just gets truncated mid-sentence in the SERP.
sed '0,/^description:/s|^description:.*|description: "The full book-to-skill spec: every step, depth budget, extraction mode, and quality rule the agent follows to turn a document into a skill."\nseo_title: "Skill Reference - The Complete book-to-skill Spec"|' \
SKILL.md > docs/skill-reference.md
cp BACKERS.md docs/BACKERS.md
# Mirror image: the docs pages link back with `../README.md`, correct on
# GitHub, a 404 on the site — where that same file is published as guide/.
sed -i -E 's,\]\(\.\./README\.md\),](guide.md),g' docs/*.md
- name: Build
run: mkdocs build
- name: Deploy to gh-pages (master push only)
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: mkdocs gh-deploy --force