Skip to content

Start using docc plugin #1463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 16 additions & 62 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,6 @@ jobs:
with:
fetch-depth: 0

- name: Checkout swift-docc
uses: actions/checkout@v2
with:
repository: apple/swift-docc
ref: main
path: swift-docc

- name: Cache DocC
id: cache-docc
uses: actions/cache@v2
with:
key: swift-url-docc-build
path: swift-docc/.build

- name: Build swift-docc
if: ${{ !steps.cache-docc.outputs.cache-hit }}
run: |
cd swift-docc; swift build --product docc -c release; cd ..

- name: Checkout swift-docc-render
uses: actions/checkout@v2
with:
repository: apple/swift-docc-render
ref: main
path: swift-docc-render

- name: Build swift-docc-render
run: |
cd swift-docc-render; npm install && npm run build; cd ..

- name: Checkout gh-pages Branch
uses: actions/checkout@v2
with:
Expand All @@ -71,41 +41,25 @@ jobs:

for tag in $(echo "main"; git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | head -6);
do
if [ -d "docs-out/$tag" ]
if [ -d "docs-out/$tag/data/documentation/composablearchitecture" ]
then
echo "✅ Documentation for "$tag" already exists.";
else
echo "⏳ Generating documentation for "$target" @ "$tag" release.";

for target in ComposableArchitecture Dependencies;
do
git checkout .;
git checkout "$tag";
mkdir -p Sources/"$target"/Documentation.docc;
export DOCC_HTML_DIR="$(pwd)/swift-docc-render/dist";

rm -rf .build/symbol-graphs;
mkdir -p .build/symbol-graphs;
swift build \
--target "$target" \
-Xswiftc \
-emit-symbol-graph \
-Xswiftc \
-emit-symbol-graph-dir \
-Xswiftc \
.build/symbol-graphs \
&& swift-docc/.build/release/docc convert Sources/"$target"/Documentation.docc \
--fallback-display-name "$target" \
--fallback-bundle-identifier co.pointfree.ComposableArchitecture \
--fallback-bundle-version 0.0.0 \
--additional-symbol-graph-dir \
.build/symbol-graphs \
--transform-for-static-hosting \
--hosting-base-path /swift-composable-architecture/"$tag" \
--output-path docs-out/"$tag" \
&& echo "✅ Documentation generated for "$target" @ "$tag" release." \
|| echo "⚠️ Documentation skipped for "$target" @ "$tag".";
done;
echo "⏳ Generating documentation for ComposableArchitecture @ "$tag" release.";
rm -rf "docs-out/$tag";

git checkout .;
git checkout "$tag";

swift package \
--allow-writing-to-directory docs-out/"$tag" \
generate-documentation \
--target ComposableArchitecture \
--output-path docs-out/"$tag" \
--transform-for-static-hosting \
--hosting-base-path /swift-composable-architecture/"$tag" \
&& echo "✅ Documentation generated for ComposableArchitecture @ "$tag" release." \
|| echo "⚠️ Documentation skipped for ComposableArchitecture @ "$tag".";
fi;
done

Expand Down