Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 25 additions & 23 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,58 @@ name: Generate Documentations
on:
push:
branches: ["main"]
tags: ['[0-9]*.[0-9]*.[0-9]*']
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
publish-docs:
env: # Environment Variables
SCHEME_NAME: MarkdownView
HOSTING_BASE_PATH: MarkdownView
environment: # Github Page environments
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

with:
ref: main
fetch-depth: 0

- name: Restore versioned documentation cache
uses: actions/cache@v6
with:
path: .docs/cache/versioned-docc
key: versioned-docc-${{ runner.os }}-${{ hashFiles('.vdc.json', 'Package.resolved') }}-${{ github.ref_type }}-${{ github.sha }}
restore-keys: |
versioned-docc-${{ runner.os }}-${{ hashFiles('.vdc.json', 'Package.resolved') }}-
versioned-docc-${{ runner.os }}-

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest

- name: Build DocC archive
id: build-docs
run: |
xcodebuild \
docbuild \
-scheme $SCHEME_NAME \
-destination "platform=macOS" \
-derivedDataPath build-docs
ARCHIVE=$(find build-docs/Build/Products -name "$SCHEME_NAME.doccarchive" -type d | head -n1)
echo "archive=$ARCHIVE" >> $GITHUB_OUTPUT

- name: Process DocC archive
run: |
xcrun docc process-archive \
transform-for-static-hosting "${{ steps.build-docs.outputs.archive }}" \
--output-path docs \
--hosting-base-path $HOSTING_BASE_PATH
- name: Build versioned DocC site
uses: DocCLab/VersionedDocC@0.0.13
with:
config: .vdc.json

- name: Configure GitHub Pages
uses: actions/configure-pages@v4

- name: Upload Pages artifacts
uses: actions/upload-pages-artifact@v3
with:
path: docs
path: .docs/build/versioned-site/MarkdownView

- id: deployment
name: Deploy to GitHub Pages
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.DS_Store
/.build
/.docs/
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
.netrc
34 changes: 34 additions & 0 deletions .vdc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://raw.githubusercontent.com/DocCLab/VersionedDocC/0.0.13/Schema/VersionedDocC.schema.json",
"schemaVersion": 1,
"projectName": "MarkdownView",
"moduleName": "MarkdownView",
"modulePath": "markdownview",
"targetName": "MarkdownView",
"catalogPath": "Sources/MarkdownView/Documentation.docc",
"hostingBasePath": "/MarkdownView",
"defaultVersion": "main",
"releasePolicy": {
"latest": 2,
"development": {
"name": "main",
"ref": "HEAD"
}
},
"sourceRepository": "https://github.com/LiYanan2004/MarkdownView",
"buildArguments": [
"--disable-index-store",
"--disable-dependency-cache",
"--disable-prefetching"
],
"allowedModules": [
"MarkdownView"
],
"symbolGraph": {
"minimumAccessLevel": "public",
"skipProtocolImplementations": true
},
"apiChanges": {
"pageSize": 10
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Powered by [swift-markdown](https://github.com/swiftlang/swift-markdown), fully
You can view documentation on:

- [main @ Swift Package Index](https://swiftpackageindex.com/LiYanan2004/MarkdownView/main/documentation/MarkdownView)
- [main @ GitHub Pages](https://liyanan2004.github.io/MarkdownView/documentation/markdownview/)
- [main @ GitHub Pages](https://liyanan2004.github.io/MarkdownView/main/documentation/markdownview/)

## Getting Started

Expand Down
Loading