Skip to content

Commit 2db73e5

Browse files
committed
docs: generate api docs
1 parent 4e234f0 commit 2db73e5

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

Diff for: .github/workflows/docs.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Generate and publish docs
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
env:
8+
# Xcode 16.3 gets us Swift 6.1, required for docc merge
9+
XCODE_VERSION: 16.3
10+
11+
jobs:
12+
build:
13+
name: Generate API docs and publish to GitHub pages
14+
# macos-15 is required for Xcode 16.3
15+
runs-on: macos-15
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- uses: jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8
21+
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
22+
with:
23+
xcode-version: ${{ env.XCODE_VERSION }}
24+
25+
- name: Install dependencies
26+
run: tuist install --path Samples
27+
28+
- name: Generate project
29+
run: tuist generate --path Samples --no-open
30+
31+
- name: Generate Docs
32+
run: Scripts/generate_docs.sh
33+
34+
- name: Deploy to GitHub Pages
35+
uses: crazy-max/ghaction-github-pages@df5cc2bfa78282ded844b354faee141f06b41865
36+
with:
37+
target_branch: gh-pages
38+
build_dir: generated_docs
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: Samples/Workspace.swift

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ let workspace = Workspace(
88
// Generate a scheme for each target in Package.swift for convenience
99
.modals("Modals"),
1010
.modals("WorkflowModals"),
11+
.scheme(
12+
name: "Documentation",
13+
buildAction: .buildAction(
14+
targets: [
15+
.project(path: "..", target: "Modals"),
16+
.project(path: "..", target: "WorkflowModals"),
17+
]
18+
)
19+
),
1120
]
1221
)
1322

Diff for: Scripts/generate_docs.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
BUILD_PATH=docs_build
4+
MERGED_PATH=generated_docs
5+
6+
xcodebuild docbuild \
7+
-scheme Documentation \
8+
-derivedDataPath "$BUILD_PATH" \
9+
-workspace Samples/ModalsDevelopment.xcworkspace \
10+
-destination generic/platform=iOS \
11+
DOCC_HOSTING_BASE_PATH='swift-modals' \
12+
| xcpretty
13+
14+
find_archive() {
15+
find "$BUILD_PATH" -type d -name "$1.doccarchive" -print -quit
16+
}
17+
18+
xcrun docc merge \
19+
$(find_archive Modals) \
20+
$(find_archive WorkflowModals) \
21+
--output-path "$MERGED_PATH" \
22+
--synthesized-landing-page-name "swift-modals"

0 commit comments

Comments
 (0)