Skip to content

Commit bdf8ca0

Browse files
authored
Add docc on a github page (#54)
* move doc to Swift Docc and keep README minimal * add doc in the header * move acknowledgment section down the page * fix ci * add test for embeddings * fix links to SPI * add generated doc to github pages * change doc base directory path * add a nojekyll file for github page * link to github page instead of SPI * add public Makefile * dynamcly add the swift docc plugin to generate the doc * update doc * ignore docs folder in soundness check * add more license ignore files * add doc github action * fix yaml * delete docs dir from repo - generate it dynamically instead
1 parent 698a7e0 commit bdf8ca0

File tree

8 files changed

+86
-12
lines changed

8 files changed

+86
-12
lines changed

.github/workflows/doc.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: DocC Runner
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
# A single job that builds and deploys the DocC documentation
20+
jobs:
21+
deploy:
22+
environment:
23+
name: github-pages
24+
url: ${{ steps.deployment.outputs.page_url }}
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v5
29+
- name: Setup Pages
30+
uses: actions/configure-pages@v5
31+
- name: Build DocC
32+
run: |
33+
make generate-doc
34+
- name: Upload artifact
35+
uses: actions/upload-pages-artifact@v4
36+
with:
37+
path: 'docs'
38+
- id: deployment
39+
name: Deploy to GitHub Pages
40+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ Package.resolved
1212
.serverless
1313
.vscode
1414
.env
15-
Makefile
1615
**/temp
1716
node_modules
18-
docc-output
1917

2018
# **/backend
2119
**/backend/.DS_Store

.licenseignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ Package.resolved
3838
**/*.code-snippets
3939
.DS_Store
4040
.licenseignore
41-
**/*.entitlements
41+
**/*.entitlements
42+
.nojekyll
43+
docs/**
44+
.unacceptablelanguageignore
45+
Makefile

.nojekyll

Whitespace-only changes.

.unacceptablelanguageignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Makefile for library
2+
3+
format:
4+
swift format format --parallel --recursive --in-place ./Package.swift Examples/ Sources/ Tests/
5+
6+
preview-docs:
7+
# xcrun docc preview Sources/BedrockService/Docs.docc --output-path docc-output
8+
swift package --disable-sandbox preview-documentation --target BedrockService
9+
10+
# https://build-on-aws.github.io/swift-bedrock-library/documentation/bedrockservice/
11+
generate-docs:
12+
# Dynamically add the swift-docc-plugin for doc generation
13+
cp Package.swift Package.swift.bak
14+
for manifest in Package.swift Package@*.swift ; do \
15+
if [[ -f "$$manifest" ]] && ! grep -E -i "https://github.com/(apple|swiftlang)/swift-docc-plugin" "$$manifest" ; then \
16+
echo "package.dependencies.append(" >> "$$manifest" ; \
17+
echo " .package(url: \"https://github.com/swiftlang/swift-docc-plugin\", from: \"1.4.5\")" >> "$$manifest" ; \
18+
echo ")" >> "$$manifest" ; \
19+
fi ; \
20+
done
21+
22+
touch .nojekyll
23+
swift package \
24+
--allow-writing-to-directory ./docs \
25+
generate-documentation \
26+
--target BedrockService \
27+
--disable-indexing \
28+
--transform-for-static-hosting \
29+
--hosting-base-path swift-bedrock-library \
30+
--output-path ./docs
31+
32+
mv Package.swift.bak Package.swift

Package.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ let package = Package(
1515
.package(url: "https://github.com/smithy-lang/smithy-swift", from: "0.158.0"),
1616
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.4"),
1717
.package(url: "https://github.com/awslabs/aws-crt-swift", from: "0.53.0"),
18-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
1918
],
2019
targets: [
2120
.target(

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A Swift library for interacting with [Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html) foundation models.
44

5-
📖 **[Complete Documentation](https://swiftpackageindex.com/build-on-aws/swift-bedrock-library/documentation)** - Comprehensive guides and API reference
5+
📖 **[Complete Documentation](https://build-on-aws.github.io/swift-bedrock-library/documentation/bedrockservice/)** - Comprehensive guides and API reference
66

77
## TL;DR - Quick Start
88

@@ -27,7 +27,7 @@ Add to your `Package.swift`:
2727

2828
```swift
2929
dependencies: [
30-
.package(url: "https://github.com/build-on-aws/swift-bedrock-library.git", branch: "main")
30+
.package(url: "https://github.com/build-on-aws/swift-bedrock-library.git", from: "1.5.0")
3131
],
3232
targets: [
3333
.target(
@@ -43,14 +43,14 @@ Requires: `platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18)]`
4343

4444
## Documentation
4545

46-
📖 **[Complete Documentation](https://swiftpackageindex.com/build-on-aws/swift-bedrock-library/documentation)** - Comprehensive guides and API reference
46+
📖 **[Complete Documentation](https://build-on-aws.github.io/swift-bedrock-library/documentation/bedrockservice/)** - Comprehensive guides and API reference
4747

4848
Key topics:
49-
- [Authentication](https://swiftpackageindex.com/build-on-aws/swift-bedrock-library/documentation/bedrockservice/authentication) - Configure AWS credentials
50-
- [Converse API](https://swiftpackageindex.com/build-on-aws/swift-bedrock-library/documentation/bedrockservice/converse) - Conversational AI
51-
- [Image Generation](https://swiftpackageindex.com/build-on-aws/swift-bedrock-library/documentation/bedrockservice/imagegeneration) - Create and modify images
52-
- [Tools](https://swiftpackageindex.com/build-on-aws/swift-bedrock-library/documentation/bedrockservice/tools) - Function calling
53-
- [Streaming](https://swiftpackageindex.com/build-on-aws/swift-bedrock-library/documentation/bedrockservice/streaming) - Real-time responses
49+
- [Authentication](https://build-on-aws.github.io/swift-bedrock-library/documentation/bedrockservice/authentication) - Configure AWS credentials
50+
- [Converse API](https://build-on-aws.github.io/swift-bedrock-library/documentation/bedrockservice/converse) - Conversational AI
51+
- [Image Generation](https://build-on-aws.github.io/swift-bedrock-library/documentation/bedrockservice/imagegeneration) - Create and modify images
52+
- [Tools](https://build-on-aws.github.io/swift-bedrock-library/documentation/bedrockservice/tools) - Function calling
53+
- [Streaming](https://build-on-aws.github.io/swift-bedrock-library/documentation/bedrockservice/streaming) - Real-time responses
5454

5555
## Examples
5656

0 commit comments

Comments
 (0)