-
Notifications
You must be signed in to change notification settings - Fork 19
56 lines (52 loc) · 1.91 KB
/
documentation-ghpages.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Deploy Documentation
on:
push:
branches:
- master
env:
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
NSUnbufferedIO: YES
# NOTE: The DocC `generate-documentation` plugin does not handle the
# hostingBasePath well. In particular, it doesn't properly handle
# multiple child paths. Furthermore, the current 1.0.0 version of
# the plugin doesn't handle updates to the index.html or *.js
# files.
#
# This workflow should be revisited once Xcode 14 GA is released
# so the newer DocC utilities can be utilized.
jobs:
ExportToGHPages:
name: Export to Github Pages
runs-on: macos-latest-large
steps:
- uses: actions/checkout@master
- name: Build Documentation
run: |
set +ex
VERSION=$(git describe --tags 2>/dev/null)
if [[ $? -ne 0 ]]; then
VERSION=development
fi
set -e
export DOCC_JSON_PRETTYPRINT=YES
for TARGET in $(swift package describe --type json | jq ".products[].name" | sed -e 's/"//g'); do
echo "Building $TARGET"
NAME=$(echo "$TARGET" | tr '[:upper:]' '[:lower:]')
mkdir -p docs/$VERSION/$NAME
swift package \
--allow-writing-to-directory docs \
generate-documentation \
--target $TARGET \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path okta-mobile-swift/$VERSION/$NAME \
--output-path docs/$VERSION/$NAME
sed -I -e "s#<head>#<head><meta http-equiv='refresh' content='0;url=./documentation/$NAME/'>#" \
docs/$VERSION/$NAME/index.html
done
- name: Deploy documentation to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
keep_files: true