Skip to content

Commit 2408412

Browse files
authored
Fix gen-docs GH action (#126)
* Fix gen-docs to use plugin * Don't install docc * Add GH specific version of build-docc
1 parent 29b5cec commit 2408412

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

.github/workflows/gen-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
env:
2525
DOCC: docc
2626
run: |
27-
./scripts/build-docc.sh
27+
./scripts/build-docc-gh.sh
2828
- name: Commit
2929
env:
3030
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

scripts/build-docc-gh.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
# GitHub action version of build-docc which does not use the plugin. While GH actions
3+
# are not available in the macOS-latest image GitHub provide this script will be necessary
4+
TEMP_DIR="$(pwd)/temp"
5+
6+
cleanup()
7+
{
8+
if [ -n "$TEMP_DIR" ]; then
9+
rm -rf $TEMP_DIR
10+
fi
11+
}
12+
trap cleanup exit $?
13+
14+
SG_FOLDER=.build/symbol-graphs
15+
MQTTNIO_SG_FOLDER=.build/mqtt-nio-symbol-graphs
16+
OUTPUT_PATH=docs/mqtt-nio/
17+
18+
BUILD_SYMBOLS=1
19+
20+
while getopts 's' option
21+
do
22+
case $option in
23+
s) BUILD_SYMBOLS=0;;
24+
esac
25+
done
26+
27+
if [ -z "${DOCC_HTML_DIR:-}" ]; then
28+
git clone https://github.com/apple/swift-docc-render-artifact $TEMP_DIR/swift-docc-render-artifact
29+
export DOCC_HTML_DIR="$TEMP_DIR/swift-docc-render-artifact/dist"
30+
fi
31+
32+
if test "$BUILD_SYMBOLS" == 1; then
33+
# build symbol graphs
34+
mkdir -p $SG_FOLDER
35+
swift build \
36+
-Xswiftc -emit-symbol-graph \
37+
-Xswiftc -emit-symbol-graph-dir -Xswiftc $SG_FOLDER
38+
# Copy MQTTNIO symbol graph into separate folder
39+
mkdir -p $MQTTNIO_SG_FOLDER
40+
cp $SG_FOLDER/MQTTNIO* $MQTTNIO_SG_FOLDER
41+
fi
42+
43+
# Build documentation
44+
mkdir -p $OUTPUT_PATH
45+
rm -rf $OUTPUT_PATH/*
46+
docc convert Sources/MQTTNIO/MQTTNIO.docc \
47+
--transform-for-static-hosting \
48+
--hosting-base-path /mqtt-nio \
49+
--fallback-display-name MQTTNIO \
50+
--fallback-bundle-identifier org.swift-server-community.mqtt-nio \
51+
--fallback-bundle-version 1 \
52+
--additional-symbol-graph-dir $MQTTNIO_SG_FOLDER \
53+
--output-path $OUTPUT_PATH

0 commit comments

Comments
 (0)