-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 2.44 KB
/
Copy pathdocc.yml
File metadata and controls
74 lines (65 loc) · 2.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
name: Deploy DocC to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
deploy:
runs-on: macos-26
environment:
name: ${{ github.ref == 'refs/heads/main' && 'github-pages' || '' }}
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.0.1'
- name: Generate Documentation
run: |
swift package --allow-writing-to-directory ./docs \
generate-documentation \
--enable-experimental-combined-documentation \
--target Subscription --target SubscriptionUI \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path swift-subscription \
--output-path ./docs
- name: Inject package overview into combined root
run: |
python3 - ./docs subscription <<'PY'
import json, os, sys
docs, core = sys.argv[1], sys.argv[2].lower()
root_p = os.path.join(docs, "data", "documentation.json")
core_p = os.path.join(docs, "data", "documentation", f"{core}.json")
if not (os.path.exists(root_p) and os.path.exists(core_p)):
print("skip: missing root/core json"); sys.exit(0)
root = json.load(open(root_p)); cm = json.load(open(core_p))
if root.get("abstract"):
print("skip: root already has abstract"); sys.exit(0)
if cm.get("abstract"): root["abstract"] = cm["abstract"]
ov = next((s for s in cm.get("primaryContentSections", []) if s.get("kind") == "content"), None)
if ov:
for k, v in cm.get("references", {}).items():
root.setdefault("references", {}).setdefault(k, v)
root.setdefault("primaryContentSections", []).insert(0, ov)
json.dump(root, open(root_p, "w"), ensure_ascii=False)
print("injected overview from", core)
PY
- name: Upload artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v4