Skip to content

Commit 7ef3c44

Browse files
author
Neno Stefanov
committed
Deploy API documentation to Pages
1 parent 7c0b45d commit 7ef3c44

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

.github/workflows/static.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy API documentation to Pages
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
branches:
7+
- '*'
8+
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
jobs:
23+
deploy:
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
runs-on: macos-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Generate documentation
33+
run: |
34+
swift package --allow-writing-to-directory ./docs \
35+
generate-documentation --target MIRACLTrust \
36+
--disable-indexing \
37+
--transform-for-static-hosting \
38+
--hosting-base-path trust-sdk-ios \
39+
--output-path ./docs
40+
41+
- name: Add redirect to the reference
42+
run: cp -f ./documentation/redirect.html ./docs/index.html
43+
44+
- name: Setup Pages
45+
uses: actions/configure-pages@v5
46+
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v3
49+
with:
50+
# Upload the generated HTML
51+
path: './docs'
52+
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

Package.resolved

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ let package = Package(
3939
)
4040
],
4141
dependencies: [
42+
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.4.5"),
4243
],
4344
targets: [
4445
.target(

documentation/redirect.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="refresh" content="0; url=./documentation/miracltrust/">
6+
<title>Redirecting…</title>
7+
</head>
8+
<body>
9+
<p>Redirecting to <a href="./documentation/miracltrust/">documentation</a>...</p>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)