Merge pull request #15 from klolev/main #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build documentation | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
name: Build documentation | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Build | |
env: | |
platform: ${{ 'iOS Simulator' }} | |
run: | | |
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"` | |
xcodebuild docbuild -scheme Placement -derivedDataPath $GITHUB_WORKSPACE/build -destination "platform=$platform,name=$device" | |
- name: Clone swift-docc | |
run: git clone -b release/5.10 https://github.com/apple/swift-docc.git | |
- name: Build swift-docc | |
run: cd swift-docc && swift build | |
- name: Run swift-docc | |
run: cd swift-docc && | |
export DOCC_HTML_DIR="$(dirname $(xcrun --find docc))/../share/docc/render" && | |
swift run docc process-archive transform-for-static-hosting ../build/Build/Products/Debug-iphonesimulator/Placement.doccarchive --output-path ../build/Docs | |
- name: Add redirect | |
env: | |
REDIRECT_HTML: | | |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>Redirecting</title> | |
<meta http-equiv="refresh" content="0; URL=https://placement.sampettersson.com/documentation/placement/"> | |
<link rel="canonical" href="https://placement.sampettersson.com/documentation/placement/"> | |
run: echo $REDIRECT_HTML > build/Docs/index.html | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build/Docs |