Skip to content

Commit b494e14

Browse files
committed
Update doc workflow
1 parent 414f920 commit b494e14

File tree

1 file changed

+30
-67
lines changed

1 file changed

+30
-67
lines changed

.github/workflows/documentation.yml

Lines changed: 30 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -9,52 +9,25 @@ on:
99
push:
1010
branches:
1111
- main
12+
- protocol-clocks
1213
workflow_dispatch:
1314

15+
concurrency:
16+
group: docs-${{ github.ref }}
17+
cancel-in-progress: true
18+
1419
jobs:
1520
build:
16-
runs-on: ubuntu-latest
21+
runs-on: macos-12
1722
steps:
23+
- name: Select Xcode 14.1
24+
run: sudo xcode-select -s /Applications/Xcode_14.1.app
25+
1826
- name: Checkout Package
1927
uses: actions/checkout@v2
2028
with:
2129
fetch-depth: 0
2230

23-
- name: Download Swift 5.5.1
24-
run: wget -q https://download.swift.org/swift-5.5.1-release/ubuntu2004/swift-5.5.1-RELEASE/swift-5.5.1-RELEASE-ubuntu20.04.tar.gz
25-
- name: Extract Swift 5.5.1
26-
run: tar xzf swift-5.5.1-RELEASE-ubuntu20.04.tar.gz
27-
- name: Add Swift toolchain to PATH
28-
run: |
29-
echo "$GITHUB_WORKSPACE/swift-5.5.1-RELEASE-ubuntu20.04/usr/bin" >> $GITHUB_PATH
30-
31-
- name: Checkout swift-docc
32-
uses: actions/checkout@v2
33-
with:
34-
repository: apple/swift-docc
35-
ref: main
36-
path: swift-docc
37-
- name: Cache DocC
38-
id: cache-docc
39-
uses: actions/cache@v2
40-
with:
41-
key: swift-url-docc-build
42-
path: swift-docc/.build
43-
- name: Build swift-docc
44-
if: ${{ !steps.cache-docc.outputs.cache-hit }}
45-
run: |
46-
cd swift-docc; swift build --product docc -c release; cd ..
47-
48-
- name: Checkout swift-docc-render
49-
uses: actions/checkout@v2
50-
with:
51-
repository: apple/swift-docc-render
52-
ref: main
53-
path: swift-docc-render
54-
- name: Build swift-docc-render
55-
run: |
56-
cd swift-docc-render; npm install && npm run build; cd ..
57-
5831
- name: Checkout gh-pages Branch
5932
uses: actions/checkout@v2
6033
with:
@@ -65,45 +38,35 @@ jobs:
6538
run: >
6639
rm -rf docs-out/.git;
6740
rm -rf docs-out/main;
41+
git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | tail -n +6 | xargs -I {} rm -rf {};
6842
69-
for tag in $(echo "main"; git tag);
43+
for tag in $(echo "main"; git tag -l --sort=-v:refname | grep -e "\d\+\.\d\+.0" | head -6);
7044
do
71-
echo "⏳ Generating documentation for "$tag" release.";
72-
73-
if [ -d "docs-out/$tag" ]
45+
if [ -d "docs-out/$tag/data/documentation/urlrouting" ]
7446
then
75-
echo "✅ Documentation for "$tag" already exists.";
47+
echo "✅ Documentation for "$tag" already exists.";
7648
else
77-
git checkout "$tag";
78-
mkdir -p Sources/URLRouting/Documentation.docc;
79-
export DOCC_HTML_DIR="$(pwd)/swift-docc-render/dist";
49+
echo "⏳ Generating documentation for URLRouting @ "$tag" release.";
50+
rm -rf "docs-out/$tag";
8051
81-
rm -rf .build/symbol-graphs;
82-
mkdir -p .build/symbol-graphs;
83-
swift build \
84-
--target URLRouting \
85-
-Xswiftc \
86-
-emit-symbol-graph \
87-
-Xswiftc \
88-
-emit-symbol-graph-dir \
89-
-Xswiftc \
90-
.build/symbol-graphs \
91-
&& swift-docc/.build/release/docc convert Sources/URLRouting/Documentation.docc \
92-
--fallback-display-name URLRouting \
93-
--fallback-bundle-identifier co.pointfree.URLRouting \
94-
--fallback-bundle-version 0.0.0 \
95-
--additional-symbol-graph-dir \
96-
.build/symbol-graphs \
97-
--transform-for-static-hosting \
98-
--hosting-base-path /swift-url-routing/"$tag" \
99-
--output-path docs-out/"$tag" \
100-
&& echo "✅ Documentation generated for "$tag" release." \
101-
|| echo "⚠️ Documentation skipped for "$tag".";
52+
git checkout .;
53+
git checkout "$tag";
54+
55+
swift package \
56+
--allow-writing-to-directory docs-out/"$tag" \
57+
generate-documentation \
58+
--target URLRouting \
59+
--output-path docs-out/"$tag" \
60+
--transform-for-static-hosting \
61+
--hosting-base-path /swift-url-routing/"$tag" \
62+
&& echo "✅ Documentation generated for URLRouting @ "$tag" release." \
63+
|| echo "⚠️ Documentation skipped for URLRouting @ "$tag".";
10264
fi;
10365
done
104-
66+
10567
- name: Fix permissions
106-
run: 'sudo chown --recursive $USER docs-out'
68+
run: 'sudo chown -R $USER docs-out'
69+
10770
- name: Publish documentation to GitHub Pages
10871
uses: JamesIves/github-pages-deploy-action@4.1.7
10972
with:

0 commit comments

Comments
 (0)