Skip to content

Commit

Permalink
Update Fastlane to build docs to a hidden folder
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Nov 1, 2022
1 parent 954659f commit 5eb83be
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ default_platform :ios

platform :ios do

build_folder_docs = ".build/docs"


# Documentation ==============

Expand Down Expand Up @@ -64,7 +66,7 @@ platform :ios do

desc "Build documentation for all platforms"
lane :docc do
sh('cd .. && rm -rf Docs')
sh('cd .. && rm -rf ' + build_folder_docs)
docc_platform(destination: 'iOS', name: 'ios')
docc_platform(destination: 'OS X', name: 'osx')
docc_platform(destination: 'tvOS', name: 'tvos')
Expand All @@ -73,17 +75,17 @@ platform :ios do

desc "Build documentation for a single platform"
lane :docc_platform do |values|
sh('cd .. && mkdir -p Docs')
sh('cd .. && mkdir -p ' + build_folder_docs)
docc_delete_derived_data
sh('cd .. && xcodebuild docbuild \
-scheme SwiftUIKit \
-destination \'generic/platform=' + values[:destination] + '\'')
sh('cd .. && \
find ~/Library/Developer/Xcode/DerivedData \
-name "SwiftUIKit.doccarchive" \
-exec cp -R {} Docs \;')
-exec cp -R {} ' + build_folder_docs + ' \;')
sh('cd .. && \
mv Docs/SwiftUIKit.doccarchive Docs/SwiftUIKit_' + values[:name] + '.doccarchive')
mv ' + build_folder_docs + '/SwiftUIKit.doccarchive ' + build_folder_docs + '/SwiftUIKit_' + values[:name] + '.doccarchive')
end

desc "Delete documentation derived data (may be historic duplicates)"
Expand All @@ -105,8 +107,8 @@ platform :ios do
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/SwiftUIKit_' + values[:name] + '.doccarchive \
--output-path Docs/web_' + values[:name] + ' \
transform-for-static-hosting ' + build_folder_docs + '/SwiftUIKit_' + values[:name] + '.doccarchive \
--output-path ' + build_folder_docs + '/web_' + values[:name] + ' \
--hosting-base-path SwiftUIKit')
end

Expand Down

0 comments on commit 5eb83be

Please sign in to comment.