Skip to content

Commit 27b6cb9

Browse files
committed
docs: generate api docs
1 parent 4e234f0 commit 27b6cb9

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

Diff for: .github/workflows/docs.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Generate and publish docs
2+
3+
on:
4+
push:
5+
branches: [ awatt/doc-gen, main ] # remove my branch before merge!
6+
7+
env:
8+
XCODE_VERSION: 16.1
9+
TUIST_TEST_DEVICE: iPad (10th generation)
10+
TUIST_TEST_PLATFORM: iOS
11+
TUIST_TEST_OS: 17.2
12+
13+
jobs:
14+
build:
15+
name: Generate API docs and publish to GitHub pages
16+
runs-on: macos-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- uses: jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8
22+
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
23+
with:
24+
xcode-version: ${{ env.XCODE_VERSION }}
25+
26+
# Get Swift 6.1 for docc merge
27+
- name: Install Swiftly and Swift 6.1
28+
uses: vapor/[email protected]
29+
with:
30+
toolchain: 6.1.0
31+
32+
- name: Install dependencies
33+
run: tuist install --path Samples
34+
35+
- name: Generate project
36+
run: tuist generate --path Samples --no-open
37+
38+
- name: Generate Docs
39+
run: Scripts/generate_docs.sh
40+
41+
- name: Deploy to GitHub Pages
42+
uses: crazy-max/ghaction-github-pages@df5cc2bfa78282ded844b354faee141f06b41865
43+
with:
44+
target_branch: gh-pages
45+
build_dir: generated_docs
46+
env:
47+
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

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
| xcpretty
12+
13+
find_archive() {
14+
find "$BUILD_PATH" -type d -name "$1.doccarchive"
15+
}
16+
17+
docc merge \
18+
$(find_archive Modals) \
19+
$(find_archive WorkflowModals) \
20+
--output-path "$MERGED_PATH" \
21+
--synthesized-landing-page-name "swift-modals"

0 commit comments

Comments
 (0)