-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add documentation generation scripts
- Loading branch information
1 parent
3541df4
commit b8123cc
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
readonly XCODE=$(xcodebuild -version | grep Xcode | cut -d " " -f2) | ||
|
||
readonly TOP_DIR=$PWD | ||
readonly BUILD_DIR="${TOP_DIR}/.build" | ||
readonly DOCUMENTATION_DIR=".build/docs" | ||
readonly OUTPUT_DIR="${TOP_DIR}/docs" | ||
|
||
readonly SCHEME=MuxPlayerSwift | ||
readonly DOCC_ARCHIVE_NAME="${SCHEME}.doccarchive" | ||
readonly DOCC_ARCHIVE_PATH="${BUILD_DIR}/${DOCC_ARCHIVE_NAME}" | ||
|
||
if ! command -v xcbeautify &> /dev/null | ||
then | ||
echo -e "\033[1;31m ERROR: xcbeautify could not be found please install it... \033[0m" | ||
exit 1 | ||
fi | ||
|
||
set -eu pipefail | ||
|
||
echo "▸ Removing build directory: ${BUILD_DIR}" | ||
|
||
rm -rf ${BUILD_DIR} | ||
|
||
echo "▸ Using Xcode Version: ${XCODE}" | ||
|
||
echo "▸ Building Documentation Catalog for ${SCHEME}" | ||
|
||
mkdir -p $DOCUMENTATION_DIR | ||
|
||
echo "▸ Creating documentation catalog with derived data path: ${DOCUMENTATION_DIR}" | ||
|
||
xcodebuild docbuild -scheme $SCHEME \ | ||
-destination 'generic/platform=iOS' \ | ||
-sdk iphoneos \ | ||
-derivedDataPath "${DOCUMENTATION_DIR}" \ | ||
OTHER_DOCC_FLAGS="--transform-for-static-hosting --hosting-base-path mux-player-swift --output-path docs" \ | ||
| xcbeautify | ||
|
||
echo "▸ Finished building Documentation Archive" | ||
|
||
zip -ry mux-player-swift-static-docs.zip docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<!-- This file is intended to replace the automatically generated index.html so it redirects to the "real" homepage for mux-player-swift docs --> | ||
<title>Redirecting to mux-player-swift homepage</title> | ||
<meta http-equiv="refresh" content="0; URL=/mux-player-swift/documentation/muxplayerswift/"> | ||
<link rel="canonical" href="/mux-player-swift/documentation/muxplayerswift/"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
if [ -z $1 ] | ||
then | ||
echo -e "\033[1;31m ERROR: this script requires a repository name parameter. \033[0m" | ||
exit $E_MISSING_POS_PARAM | ||
fi | ||
|
||
if [ -z $2 ] | ||
then | ||
echo -e "\033[1;31m ERROR: this script requires a target name parameter. \033[0m" | ||
exit $E_MISSING_POS_PARAM | ||
fi | ||
|
||
echo "▸ Adding redirect from the docc static archive root" | ||
|
||
output_path="docs" | ||
|
||
sed -e "s/__SLUG__/${1}/g" \ | ||
-e "s/__TARGET__/${2}/g" \ | ||
"scripts/docc-files/index.html.template" > ${output_path}/index.html | ||
|
||
echo "▸ Rewrote ${output_path}/index.html to:" | ||
|
||
cat ${output_path}/index.html | ||
|
||
echo "▸ Copy theme settings to static archive" | ||
|
||
cp scripts/docc-files/theme-settings.json docs |