File tree Expand file tree Collapse file tree 2 files changed +77
-4
lines changed Expand file tree Collapse file tree 2 files changed +77
-4
lines changed Original file line number Diff line number Diff line change
1
+ name : Generate Documentation
2
+
3
+ on :
4
+ release :
5
+ types : [published]
6
+ workflow_dispatch :
7
+
8
+ jobs :
9
+ build :
10
+
11
+ runs-on : macOS-latest
12
+
13
+ steps :
14
+ - name : Checkout
15
+ uses : actions/checkout@v3
16
+ with :
17
+ fetch-depth : 0
18
+ - name : Install Dependencies
19
+ run : |
20
+ brew install mint
21
+ mint install apple/swift-docc@main
22
+ echo "$HOME/.mint/bin" >> $GITHUB_PATH
23
+ - name : Build
24
+ env :
25
+ DOCC : docc
26
+ run : |
27
+ ./scripts/build-docc.sh
28
+ - name : Commit
29
+ env :
30
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
31
+ REMOTE_BRANCH : " gh-pages"
32
+ run : |
33
+ REMOTE_REPO="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
34
+ git config user.name "${GITHUB_ACTOR}"
35
+ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
36
+
37
+ mv docs _docs
38
+ git checkout ${REMOTE_BRANCH}
39
+ rm -rf docs/
40
+ mv _docs/mqtt-nio docs
41
+
42
+ git add --all docs
43
+ git status
44
+ git commit -m "Documentation for https://github.com/${GITHUB_REPOSITORY}/tree/${GITHUB_SHA}" -m "Generated by gen-docs.yml"
45
+ git push ${REMOTE_REPO} ${REMOTE_BRANCH}
46
+
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- DOCC=$( xcrun --find docc)
4
- export DOCC_HTML_DIR=" $( dirname $DOCC ) /../share/docc/render"
3
+ # if plugin worked for us then would use it over everything below
4
+ usePlugin ()
5
+ {
6
+ mkdir -p ./docs/mqtt-nio
7
+
8
+ swift package \
9
+ --allow-writing-to-directory ./docs \
10
+ generate-documentation \
11
+ --target MQTTNIO \
12
+ --output-path ./docs/mqtt-nio \
13
+ --transform-for-static-hosting \
14
+ --hosting-base-path /mqtt-nio
15
+ }
16
+
17
+ TEMP_DIR=" $( pwd) /temp"
18
+
19
+ cleanup ()
20
+ {
21
+ if [ -n " $TEMP_DIR " ]; then
22
+ rm -rf $TEMP_DIR
23
+ fi
24
+ }
25
+ trap cleanup exit $?
26
+
5
27
SG_FOLDER=.build/symbol-graphs
6
28
MQTTNIO_SG_FOLDER=.build/mqtt-nio-symbol-graphs
7
- OUTPUT_PATH=docs/mqtt-nio
29
+ OUTPUT_PATH=docs/mqtt-nio/
8
30
9
31
BUILD_SYMBOLS=1
10
32
15
37
esac
16
38
done
17
39
40
+ if [ -z " ${DOCC_HTML_DIR:- } " ]; then
41
+ git clone https://github.com/apple/swift-docc-render-artifact $TEMP_DIR /swift-docc-render-artifact
42
+ export DOCC_HTML_DIR=" $TEMP_DIR /swift-docc-render-artifact/dist"
43
+ fi
44
+
18
45
if test " $BUILD_SYMBOLS " == 1; then
19
46
# build symbol graphs
20
47
mkdir -p $SG_FOLDER
@@ -23,7 +50,7 @@ if test "$BUILD_SYMBOLS" == 1; then
23
50
-Xswiftc -emit-symbol-graph-dir -Xswiftc $SG_FOLDER
24
51
# Copy MQTTNIO symbol graph into separate folder
25
52
mkdir -p $MQTTNIO_SG_FOLDER
26
- cp -f $SG_FOLDER /MQTTNIO* $MQTTNIO_SG_FOLDER
53
+ cp $SG_FOLDER /MQTTNIO* $MQTTNIO_SG_FOLDER
27
54
fi
28
55
29
56
# Build documentation
You can’t perform that action at this time.
0 commit comments