@@ -20,6 +20,11 @@ concurrency:
2020 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
2121 cancel-in-progress : true
2222
23+ permissions :
24+ contents : write
25+ pages : write
26+ id-token : write
27+
2328jobs :
2429 generate_and_deploy_docs :
2530 name : Build Documentation
3136 macos : ['macos-14']
3237 scheme : ['Lite']
3338 command : ['docbuild']
34- platform : ['macOS'] # ADD 'iOS', 'tvOS', 'watchOS'
39+ platform : ['macOS', 'iOS', 'tvOS', 'watchOS']
3540 steps :
3641 - name : Switch xcode to ${{ matrix.xcode }}
3742 uses : maxim-lobanov/setup-xcode@v1.5.1
@@ -52,23 +57,32 @@ jobs:
5257 - name : Skip Macro Validation
5358 run : defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
5459 - name : Generate DocC Documentation
60+ id : generate_docs
5561 run : |
56- xcodebuild docbuild -scheme Lite -destination generic/platform=macOS -derivedDataPath ./build
62+ xcodebuild docbuild -scheme Lite -destination generic/platform=${{ matrix.platform }} -derivedDataPath ./build
5763 doccarchive_path=$(find ./build -name '*.doccarchive' -print -quit)
5864 if [ -z "$doccarchive_path" ]; then
5965 echo "No .doccarchive file found."
6066 exit 1
6167 fi
62-
68+ echo "::set-output name=doccarchive_path::$doccarchive_path"
6369 - name : Convert DocC Archive to Static Website
64- uses : fwcd/swift-docc-action@v1
70+ run : |
71+ docc_path=$(xcrun --find docc)
72+ if [ -z "$docc_path" ]; then
73+ echo "docc command not found."
74+ exit 1
75+ fi
76+ ${docc_path} process-archive transform-for-static-hosting ${{ steps.generate_docs.outputs.doccarchive_path }} \
77+ --output-path ./docs \
78+ --hosting-base-path /Lite
79+ - name : Setup Pages
80+ uses : actions/configure-pages@v5
81+ - name : Upload artifact
82+ uses : actions/upload-pages-artifact@v3
6583 with :
66- inputs : " ${{ steps.generate_docs.outputs.doccarchive_path }}"
67- output : " ./docs"
68- base-url : " Lite"
84+ path : ' ./docs'
6985 - name : Deploy to GitHub Pages
70- uses : peaceiris/actions-gh-pages@v3
71- with :
72- github_token : ${{ secrets.GITHUB_TOKEN }}
73- publish_dir : ./docs
74- keep_files : false
86+ id : deployment
87+ uses : actions/deploy-pages@v4
88+
0 commit comments