Repository navigation
114 lines (108 loc) · 3.63 KB
/
Copy pathdocc-github-pages.yml
File metadata and controls
114 lines (108 loc) · 3.63 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#
# This source file is part of the Schmiedmayer Lab open-source organization
#
# SPDX-FileCopyrightText: 2026 Schmiedmayer Lab and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#
name: Deploy DocC Documentation
on:
workflow_call:
inputs:
path:
description: |
The path where the project is located. Defaults to $GITHUB_WORKSPACE.
required: false
type: string
default: '.'
runsonlabels:
description: |
JSON-based collection of labels indicating which type of GitHub runner should be chosen.
required: false
type: string
default: '["macos-26"]'
xcodeversion:
description: |
The Xcode version used for the build.
required: false
type: string
default: 'latest-stable'
scheme:
description: |
The scheme in the Xcode project.
The scheme to use for building documentation.
required: true
type: string
destination:
description: |
The destination parameter that should be passed to xcodebuild.
Defaults to the iOS simulator using an iPhone 17 Pro.
required: false
type: string
default: 'platform=iOS Simulator,name=iPhone 17 Pro'
dryrun:
description: |
Dry-run deployment. Build documentation but do not publish it.
required: false
type: boolean
default: false
permissions:
contents: read
pages: write
id-token: write
jobs:
deploydocs:
name: Deploy DocC Documentation
runs-on: ${{ fromJson(inputs.runsonlabels) }}
defaults:
run:
working-directory: ${{ inputs.path }}
environment:
name: ${{ !inputs.dryrun && 'github-pages' || '' }}
url: ${{ !inputs.dryrun && steps.deployment.outputs.page_url || '' }}
steps:
- uses: actions/checkout@v7
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ inputs.xcodeversion }}
- name: Check environment
run: |
xcodebuild -version
swift --version
echo "github-hosted: ${{ runner.environment == 'github-hosted' }}"
echo "environment: ${{ !inputs.dryrun && 'github-pages' || '' }}"
- name: Install xcbeautify
if: ${{ runner.environment == 'github-hosted' }}
run: brew install xcbeautify
- name: Build DocC
env:
DESTINATION: ${{ inputs.destination }}
SCHEME: ${{ inputs.scheme }}
run: |
xcodebuild docbuild \
-derivedDataPath .derivedData \
-scheme "$SCHEME" \
-destination "$DESTINATION" \
-skipPackagePluginValidation \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY="" \
-skipPackagePluginValidation \
-skipMacroValidation \
| xcbeautify
docc_path="$(xcrun --find docc)"
"$docc_path" process-archive \
transform-for-static-hosting ".derivedData/Build/Products/Debug-iphonesimulator/${SCHEME}.doccarchive" \
--hosting-base-path "${GITHUB_REPOSITORY##*/}" \
--output-path .docs \
| xcbeautify
target_name="$(printf '%s' "$SCHEME" | tr '[:upper:]' '[:lower:]')"
echo "<script>window.location.href += \"/documentation/$target_name\"</script>" > .docs/index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
include-hidden-files: true
path: '.docs'
- name: Deploy to GitHub Pages
id: deployment
if: ${{ !inputs.dryrun }}
uses: actions/deploy-pages@v5