diff --git a/.gitignore b/.gitignore index cfe64c1..b81702e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ # Documentation Docs +documentation +downloads +videos # Fastlane Fastlane/report.xml diff --git a/Fastlane/Fastfile b/Fastlane/Fastfile index 574b2e6..3a12c2f 100644 --- a/Fastlane/Fastfile +++ b/Fastlane/Fastfile @@ -20,14 +20,6 @@ platform :ios do sh("swift test") end - - # Docs ======================= - - desc "Build documentation" - lane :documentation do - sh('cd .. && fastlane/build-documentation.sh') - end - # Version ==================== @@ -41,22 +33,89 @@ platform :ios do documentation bump_type = options[:type] - if bump_type == nil or bump_type.empty? - bump_type = "patch" - end - - version = version_bump_podspec(path: "DSSwiftKit.podspec", bump_type: bump_type) - # increment_version_number(version_number: version) - - git_commit( - path: "*", - message: "Bump to #{version}" - ) + version = version_bump_podspec( + path: "DSSwiftKit.podspec", + bump_type: bump_type) + git_commit(path: "*", message: "Bump to #{version}") add_git_tag(tag: version) push_git_tags() push_to_git_remote() pod_push() 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 diff --git a/Fastlane/build-documentation.sh b/Fastlane/build-documentation.sh deleted file mode 100755 index 7d1db0b..0000000 --- a/Fastlane/build-documentation.sh +++ /dev/null @@ -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 ..