Skip to content

Commit

Permalink
chore: make docs-all (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: danthorpe <danthorpe@users.noreply.github.com>
  • Loading branch information
danthorpe and danthorpe authored Apr 12, 2024
1 parent 795ddc4 commit ce66fae
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 24 deletions.
35 changes: 11 additions & 24 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
types:
- published
push:
branches:
- main
workflow_dispatch:

concurrency:
Expand All @@ -36,34 +34,23 @@ jobs:
run: >
rm -rf docs-out/.git;
rm -rf docs-out/main;
declare -a targets=("Cache", "Protected", "ShortID")
git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | tail -n +6 | xargs -I {} rm -rf {};
for tag in $(echo "main"; git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | head -6);
do
for target in "${targets[@]}"
do
if [ -d "docs-out/$target/$tag/data/documentation/networking" ]
then
echo "✅ Documentation for $target / $tag already exists.";
else
echo "⏳ Generating documentation for $target @ $tag release.";
rm -rf "docs-out/$target/$tag";
if [ -d "docs-out/$tag/ShortID/data/documentation/shortid" ]
then
echo "✅ Documentation for $tag already exists.";
else
echo "⏳ Generating documentation for @ $tag release.";
rm -rf "docs-out/$tag";
git checkout .;
git checkout "$tag";
git checkout .;
git checkout "$tag";
swift package \
--allow-writing-to-directory docs-out/"$target"/$tag" \
generate-documentation \
--target $target \
--output-path docs-out/"$target"/"$tag" \
--transform-for-static-hosting \
--hosting-base-path /swift-networking/"$target"/"$tag" \
&& echo "✅ Documentation generated for $target @ $tag release." \
|| echo "⚠️ Documentation skipped for $target @ $tag.";
fi;
done
make tag="$tag" output=docs-out basepath=swift-utilities docs-all
fi;
done
- name: Fix permissions
Expand Down
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CONFIG = debug
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17.2,iPhone \d\+ Pro [^M])
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS 17.2,TV)
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS 1.0,Vision)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS 10.2,Watch)

default:
test-all

test-all:
swift test

docs-all:
$(MAKE) docs output=$(output) tag=$(tag) basepath=$(basepath) target=Cache
$(MAKE) docs output=$(output) tag=$(tag) basepath=$(basepath) target=Protected
$(MAKE) docs output=$(output) tag=$(tag) basepath=$(basepath) target=ShortID

docs:
mkdir -p $(output)/$(tag)/$(target)
swift package \
--allow-writing-to-directory $(output)/$(tag)/$(target) \
generate-documentation --target $(target) \
--output-path $(output)/$(tag)/$(target) \
--transform-for-static-hosting \
--hosting-base-path /$(basepath)/$(tag)/$(target) \
&& echo "✅ Documentation generated for $(target) @ $(tag) release." \
|| echo "⚠️ Documentation skipped for $(target) @ $(tag)."

0 comments on commit ce66fae

Please sign in to comment.