Skip to content

Commit e600841

Browse files
Generate docs on CI (#37)
* Generate docs in CI * wip * Update documentation.yml * Update documentation.yml Co-authored-by: Stephen Celis <[email protected]>
1 parent 5a5457a commit e600841

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
branches:
99
- '*'
1010

11+
concurrency:
12+
group: docs-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
build:
1317
name: MacOS
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Build and deploy DocC to GitHub pages. Based off of @karwa's work here:
2+
# https://github.com/karwa/swift-url/blob/main/.github/workflows/docs.yml
3+
name: Documentation
4+
5+
on:
6+
release:
7+
types:
8+
- published
9+
push:
10+
branches:
11+
- main
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: docs-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: macos-12
21+
steps:
22+
- name: Select Xcode 14.1
23+
run: sudo xcode-select -s /Applications/Xcode_14.1.app
24+
25+
- name: Checkout Package
26+
uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Checkout gh-pages Branch
31+
uses: actions/checkout@v3
32+
with:
33+
ref: gh-pages
34+
path: docs-out
35+
36+
- name: Build documentation
37+
run: >
38+
rm -rf docs-out/.git;
39+
rm -rf docs-out/main;
40+
git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | tail -n +6 | xargs -I {} rm -rf {};
41+
42+
for tag in $(echo "main"; git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | head -6);
43+
do
44+
if [ -d "docs-out/$tag/data/documentation/xctestdynamicoverlay" ]
45+
then
46+
echo "✅ Documentation for "$tag" already exists.";
47+
else
48+
echo "⏳ Generating documentation for XCTestDynamicOverlay @ "$tag" release.";
49+
rm -rf "docs-out/$tag";
50+
51+
git checkout .;
52+
git checkout "$tag";
53+
54+
swift package \
55+
--allow-writing-to-directory docs-out/"$tag" \
56+
generate-documentation \
57+
--target XCTestDynamicOverlay \
58+
--output-path docs-out/"$tag" \
59+
--transform-for-static-hosting \
60+
--hosting-base-path /xctest-dynamic-overlay/"$tag" \
61+
&& echo "✅ Documentation generated for XCTestDynamicOverlay @ "$tag" release." \
62+
|| echo "⚠️ Documentation skipped for XCTestDynamicOverlay @ "$tag".";
63+
fi;
64+
done
65+
66+
- name: Fix permissions
67+
run: 'sudo chown -R $USER docs-out'
68+
69+
- name: Publish documentation to GitHub Pages
70+
uses: JamesIves/[email protected]
71+
with:
72+
branch: gh-pages
73+
folder: docs-out
74+
single-commit: true

.github/workflows/format.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
concurrency:
9+
group: docs-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
swift_format:
1014
name: swift-format

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ extension AppDependencies {
166166

167167
The above `placeholder` parameters can be left off, but will fatal error when the endpoint is called.
168168

169+
## Documentation
170+
171+
Full documentation can be found [here][docs].
172+
169173
## License
170174

171175
This library is released under the MIT license. See [LICENSE](LICENSE) for details.
176+
177+
[docs]: https://pointfreeco.github.io/xctest-dynamic-overlay/main/documentation/xctestdynamicoverlay

0 commit comments

Comments
 (0)