Update Fastfile documentation scripts

This commit is contained in:
Daniel Saidi 2022-04-27 13:42:06 +02:00
parent b23977cf0e
commit b7bbe6acb3
3 changed files with 81 additions and 45 deletions

3
.gitignore vendored
View File

@ -6,6 +6,9 @@
# Documentation # Documentation
Docs Docs
documentation
downloads
videos
# Fastlane # Fastlane
Fastlane/report.xml Fastlane/report.xml

View File

@ -21,14 +21,6 @@ platform :ios do
end end
# Docs =======================
desc "Build documentation"
lane :documentation do
sh('cd .. && fastlane/build-documentation.sh')
end
# Version ==================== # Version ====================
desc "Create a new version" desc "Create a new version"
@ -41,22 +33,89 @@ platform :ios do
documentation documentation
bump_type = options[:type] bump_type = options[:type]
if bump_type == nil or bump_type.empty? version = version_bump_podspec(
bump_type = "patch" path: "DSSwiftKit.podspec",
end bump_type: bump_type)
version = version_bump_podspec(path: "DSSwiftKit.podspec", bump_type: bump_type)
# increment_version_number(version_number: version)
git_commit(
path: "*",
message: "Bump to #{version}"
)
git_commit(path: "*", message: "Bump to #{version}")
add_git_tag(tag: version) add_git_tag(tag: version)
push_git_tags() push_git_tags()
push_to_git_remote() push_to_git_remote()
pod_push() pod_push()
end end
# Docs =======================
desc "Build documentation for all platforms"
lane :docc do
sh('cd .. && rm -rf Docs')
docc_platform(destination: 'iOS', name: 'ios')
docc_platform(destination: 'OS X', name: 'osx')
docc_platform(destination: 'tvOS', name: 'tvos')
docc_platform(destination: 'watchOS', name: 'watchos')
end
desc "Build documentation for a single platform"
lane :docc_platform do |values|
sh('cd .. && mkdir -p Docs')
docc_delete_derived_data
sh('cd .. && xcodebuild docbuild \
-scheme SwiftKit \
-destination \'generic/platform=' + values[:destination] + '\'')
sh('cd .. && \
find ~/Library/Developer/Xcode/DerivedData \
-name "SwiftKit.doccarchive" \
-exec cp -R {} Docs \;')
sh('cd .. && \
mv Docs/SwiftKit.doccarchive Docs/SwiftKit_' + values[:name] + '.doccarchive')
end
desc "Delete documentation derived data (may be historic duplicates)"
lane :docc_delete_derived_data do
sh('find ~/Library/Developer/Xcode/DerivedData \
-name "SwiftKit.doccarchive" \
-exec rm -Rf {} \; || true')
end
desc "Build static documentation websites for all platforms"
lane :docc_web do
docc
docc_web_platform(name: 'ios')
docc_web_platform(name: 'osx')
docc_web_platform(name: 'tvos')
docc_web_platform(name: 'watchos')
end
desc "Build static documentation website for a single platform"
lane :docc_web_platform do |values|
sh('cd .. && $(xcrun --find docc) process-archive \
transform-for-static-hosting Docs/SwiftKit_' + values[:name] + '.doccarchive \
--output-path Docs/web_' + values[:name] + ' \
--hosting-base-path SwiftKit')
end
desc "Build static web documentation (macOS only)"
lane :docc_web_plugin do
sh('cd .. && mkdir -p Docs')
sh('cd .. && swift package \
--allow-writing-to-directory Docs \
generate-documentation \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path SwiftKit \
--output-path Docs/web')
end
desc "Build and preview static documentation website (macOS only)"
lane :docc_webpreview_plugin do
sh('cd .. && mkdir -p Docs')
sh('cd .. && swift package \
--disable-sandbox \
preview-documentation \
--transform-for-static-hosting \
--hosting-base-path SwiftKit \
--output-path Docs/web')
end
end end

View File

@ -1,26 +0,0 @@
#!/bin/sh
rm -rf Docs
mkdir -p Docs
xcodebuild docbuild \
-scheme SwiftKit \
-destination generic/platform=iOS \
echo "Copying documentation archive..."
find ~/Library/Developer/Xcode/DerivedData \
-name "SwiftKit.doccarchive" \
-exec cp -R {} Docs \;
cd Docs
echo "Compressing documentation archive..."
zip -r \
SwiftKit.doccarchive.zip \
SwiftKit.doccarchive
rm -rf SwiftKit.doccarchive
cd ..