Skip to content

Commit a794d30

Browse files
authored
update docs generation script to work better with selinux (#173)
motivation: docs scripts is broken on selinux due to restriction on ssh-agent changes: * change the jazzy workspace to a directory accessible by the CI node so we can push from the agent instead of from the docker container * dont remove older docs when pushing new ones * add version information and source links
1 parent 473c518 commit a794d30

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Diff for: scripts/generate_docs.sh

+12-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ if ! command -v jazzy > /dev/null; then
5252
gem install jazzy --no-ri --no-rdoc
5353
fi
5454

55-
module_switcher="docs/$version/README.md"
55+
jazzy_dir="$root_path/.build/jazzy"
56+
rm -rf "$jazzy_dir"
57+
mkdir -p "$jazzy_dir"
58+
59+
module_switcher="$jazzy_dir/README.md"
5660
jazzy_args=(--clean
5761
--author 'AsyncHTTPClient team'
5862
--readme "$module_switcher"
@@ -74,21 +78,24 @@ EOF
7478

7579
tmp=`mktemp -d`
7680
for module in "${modules[@]}"; do
77-
args=("${jazzy_args[@]}" --output "$tmp/docs/$version/$module" --docset-path "$tmp/docset/$version/$module" --module "$module")
81+
args=("${jazzy_args[@]}" --output "$jazzy_dir/docs/$version/$module" --docset-path "$jazzy_dir/docset/$version/$module"
82+
--module "$module" --module-version $version
83+
--root-url "https://swift-server.github.io/async-http-client/docs/$version/$module/")
7884
if [[ -f "$root_path/.build/sourcekitten/$module.json" ]]; then
7985
args+=(--sourcekitten-sourcefile "$root_path/.build/sourcekitten/$module.json")
8086
fi
8187
jazzy "${args[@]}"
8288
done
8389

8490
# push to github pages
85-
if [[ $CI == true ]]; then
91+
if [[ $PUSH == true ]]; then
8692
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
8793
GIT_AUTHOR=$(git --no-pager show -s --format='%an <%ae>' HEAD)
8894
git fetch origin +gh-pages:gh-pages
8995
git checkout gh-pages
90-
rm -rf "docs"
91-
cp -r "$tmp/docs" .
96+
rm -rf "docs/$version"
97+
rm -rf "docs/current"
98+
cp -r "$jazzy_dir/docs/$version" docs/
9299
cp -r "docs/$version" docs/current
93100
git add --all docs
94101
echo '<html><head><meta http-equiv="refresh" content="0; url=docs/current/AsyncHTTPClient/index.html" /></head></html>' > index.html

0 commit comments

Comments
 (0)