-
Notifications
You must be signed in to change notification settings - Fork 262
72 lines (66 loc) · 2.01 KB
/
docc.yml
File metadata and controls
72 lines (66 loc) · 2.01 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Publish DocC
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Generate DocC
run: |
mkdir -p docs
swift package --allow-writing-to-directory "$PWD/docs" generate-documentation \
--target SwiftTerm \
--output-path ./docs \
--transform-for-static-hosting \
--hosting-base-path "${{ github.event.repository.name }}"
- name: Add redirect index.html
run: |
docc_root="./docs"
docc_section="$(ls -1 "${docc_root}/documentation" | head -n 1)"
if [ -z "${docc_section}" ]; then
echo "No documentation section found in ${docc_root}/documentation" >&2
exit 1
fi
cat > "${docc_root}/index.html" <<EOF
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0; url=documentation/${docc_section}/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Redirecting...</title>
<link rel="canonical" href="documentation/${docc_section}/" />
</head>
<body>
<p>Redirecting to <a href="documentation/${docc_section}/">documentation</a>.</p>
</body>
</html>
EOF
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4