Skip to content

Commit a4a77a3

Browse files
committed
Merge remote-tracking branch 'origin/awatt/link-new-swift-docs'
* origin/awatt/link-new-swift-docs: Link to new Swift API docs
2 parents c39620f + 789c1bf commit a4a77a3

File tree

4 files changed

+9
-158
lines changed

4 files changed

+9
-158
lines changed

.github/workflows/update-docs.yml

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ on:
1111
description: 'Kotlin Git ref to publish'
1212
default: 'main'
1313
required: true
14-
swift-ref:
15-
description: 'Swift Git ref to publish'
16-
default: 'main'
17-
required: true
1814
docs-branch:
1915
description: 'Branch name for updated documentation to be published'
2016
required: true
@@ -37,33 +33,6 @@ jobs:
3733
ref: ${{ github.event.inputs.kotlin-ref }}
3834
path: 'workflow-kotlin'
3935

40-
- name: Check out Swift repo
41-
uses: actions/checkout@v3
42-
with:
43-
repository: 'square/workflow-swift'
44-
ref: ${{ github.event.inputs.swift-ref }}
45-
path: 'workflow-swift'
46-
47-
# Ruby Gems
48-
- name: Load gem cache
49-
uses: actions/cache@v3
50-
with:
51-
path: workflow-swift/.bundle
52-
key: gems-${{ hashFiles('workflow-swift/Gemfile.lock') }}
53-
54-
- name: Set up Swift environment
55-
run: |
56-
# Set global bundle path so it gets used by build_swift_docs.sh running in the nested repo as well.
57-
cd workflow-swift
58-
bundle config --global path "$(pwd)/.bundle"
59-
bundle check || bundle install
60-
61-
# Don't need to run pod gen, the website script does that itself.
62-
brew install sourcedocs
63-
64-
# Use Xcode
65-
sudo xcode-select -s /Applications/Xcode_15.1.app
66-
6736
# Docs dependencies
6837
- name: Set up Python
6938
uses: actions/setup-python@v4
@@ -82,20 +51,6 @@ jobs:
8251
distribution: 'zulu'
8352
java-version: 17
8453

85-
# Build Swift docs
86-
- name: Build Swift docs
87-
run: |
88-
mkdir -p workflow/docs/swift/api
89-
90-
cd workflow-swift
91-
bundle exec pod gen Development.podspec
92-
cd gen/Development
93-
94-
sourcedocs generate --output-folder "../../../workflow/docs/swift/api/Workflow" -- -scheme Workflow -workspace Development.xcworkspace
95-
sourcedocs generate --output-folder "../../../workflow/docs/swift/api/WorkflowUI" -- -scheme WorkflowUI -workspace Development.xcworkspace
96-
sourcedocs generate --output-folder "../../../workflow/docs/swift/api/WorkflowTesting" -- -scheme WorkflowTesting -workspace Development.xcworkspace
97-
sourcedocs generate --output-folder "../../../workflow/docs/swift/api/WorkflowReactiveSwift" -- -scheme WorkflowReactiveSwift -workspace Development.xcworkspace
98-
9954
# Build Kotlin docs
10055
- name: Build Kotlin docs
10156
run: |
@@ -127,7 +82,6 @@ jobs:
12782
run: |
12883
# Get the source repo SHAs
12984
KOTLIN_REF=$(git --git-dir workflow-kotlin/.git log -1 --format='%H')
130-
SWIFT_REF=$(git --git-dir workflow-swift/.git log -1 --format='%H')
13185
13286
cd workflow-publish
13387
git checkout -b ${{ github.event.inputs.docs-branch }}
@@ -137,5 +91,5 @@ jobs:
13791
13892
# Commit and push
13993
git add .
140-
git commit -m "Update documentation" -m "Docs built from square/workflow-kotlin@$KOTLIN_REF and square/workflow-swift@$SWIFT_REF"
94+
git commit -m "Update documentation" -m "Docs built from square/workflow-kotlin@$KOTLIN_REF"
14195
git push origin HEAD:${{ github.event.inputs.docs-branch }}

RELEASING.md

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ consists of three parts:
1212
1. Kotlin API reference: Kdoc embedded in Kotlin source files is converted to GitHub-flavored
1313
Markdown by Dokka and then included in the statically-generated website.
1414
1. Swift API reference: Markup comments from Swift files are converted Markdown by
15-
[Sourcedocs](https://github.com/eneko/SourceDocs) and then included in the statically-generated
16-
website.
15+
[DocC](https://www.swift.org/documentation/docc/) and then published independently at [square.github.io/workflow-swift/documentation](https://square.github.io/workflow-swift/documentation).
1716

1817
**Note: The documentation site is automatically built and deployed whenever a version tag is pushed.
1918
You only need these steps if you want to work on the site locally.**
@@ -32,44 +31,9 @@ cd kotlin
3231
./gradlew dokka
3332
```
3433

35-
#### Swift: Sourcedocs
34+
#### Swift: DocC
3635

37-
Sourcedocs generates a Markdown site from Swift files. You need Ruby, rubygems,
38-
bundler (2.x), Xcode 10.2+, CocoaPods, and of course Sourcedocs itself, to run it. Assuming you've
39-
already got Xcode, Ruby, and rubygems set up, install the rest of the dependencies:
40-
41-
```bash
42-
gem install bundler cocoapods
43-
brew install sourcedocs
44-
```
45-
46-
You will also need a checkout of the Swift repo:
47-
48-
```bash
49-
git clone https://github.com/square/workflow-swift.git
50-
cd workflow-swift
51-
```
52-
53-
Then generate an Xcode project before running Sourcedocs:
54-
55-
```bash
56-
cd Samples/SampleApp/
57-
bundle exec pod install
58-
# If this is your first time running CocoaPods, that will fail and you'll need to run this instead:
59-
#bundle exec pod install --repo-update
60-
```
61-
62-
You can manually generate the docs to verify everything is working correctly by running:
63-
64-
```bash
65-
#cd Samples/SampleApp/
66-
sourcedocs generate -- -scheme Workflow -workspace SampleApp.xcworkspace
67-
sourcedocs generate -- -scheme WorkflowUI -workspace SampleApp.xcworkspace
68-
sourcedocs generate -- -scheme WorkflowTesting -workspace SampleApp.xcworkspace
69-
```
70-
71-
Note that currently sourcedocs only supports Xcode 10, if you run it with Xcode 11 you might see
72-
an error about Catalyst and only empty READMEs will get generated.
36+
The Swift documentation is published by CI in the Swift repo and linked from the cross-platform Workflow docs. For info on how to generate the Swift docs locally, check out [the workflow-swift repo](https://github.com/square/workflow-swift).
7337

7438
#### mkdocs
7539

deploy_website.sh

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,18 @@
2222
# pip install -r requirements.txt
2323
# Preview the site as you're editing it with:
2424
# mkdocs serve
25-
# It also uses CocoaPods and Sourcedocs to build the Swift docs.
26-
# See .buildscript/build_swift_docs.sh for setup info.
2725
#
28-
# Usage deploy_website.sh --kotlin-ref SHA_OR_REF_TO_DEPLOY --swift-ref SHA_OR_REF_TO_DEPLOY
26+
# Usage deploy_website.sh --kotlin-ref SHA_OR_REF_TO_DEPLOY
2927
# Set the DRY_RUN environment variable to any non-null value to skip the actual deploy.
3028
# A custom username/password can be used to authenticate to the git repo by setting
3129
# the GIT_USERNAME and GIT_PASSWORD environment variables.
3230
#
33-
# E.g. to test the script: DRY_RUN=true ./deploy_website.sh --kotlin-ref main --swift-ref main
31+
# E.g. to test the script: DRY_RUN=true ./deploy_website.sh --kotlin-ref main
3432

3533
# Automatically exit the script on error.
3634
set -e
3735

3836
KOTLIN_REPO=square/workflow-kotlin
39-
SWIFT_REPO=square/workflow-swift
4037

4138
if [ -z "$WORKFLOW_GOOGLE_ANALYTICS_KEY" ]; then
4239
echo "Must set WORKFLOW_GOOGLE_ANALYTICS_KEY to deploy." >&2
@@ -92,80 +89,20 @@ function buildKotlinDocs() {
9289
echo "Kotlin docs finished."
9390
}
9491

95-
# This function uses SourceDocs.
96-
# https://github.com/eneko/SourceDocs
97-
# brew install sourcedocs
98-
# It requires Xcode (minimum 10.2) to run.
99-
# Note if you get error messages from pod gen, try running:
100-
# bundle exec pod repo update
101-
function buildSwiftDocs() {
102-
local deployRef="$1"
103-
local targetDir="$2"
104-
local workingDir=deploy-swift
105-
local workflowSchemes=(Workflow WorkflowUI WorkflowTesting WorkflowReactiveSwift)
106-
107-
if [[ -z "$deployRef" ]]; then echo "buildSwiftDocs: Must pass deploy ref as first arg" >&2; exit 1; fi
108-
if [[ -z "$targetDir" ]]; then echo "buildSwiftDocs: Must pass target dir as second arg" >&2; exit 1; fi
109-
110-
if [[ -d "$workingDir" ]]; then
111-
echo "Removing old working directory $workingDir..."
112-
rm -rf "$workingDir"
113-
fi
114-
115-
echo "Shallow-cloning $SWIFT_REPO from $deployRef into $workingDir..."
116-
git clone --depth 1 --branch $deployRef $(getAuthenticatedRepoUrl $SWIFT_REPO) $workingDir
117-
118-
echo "Building Swift docs..."
119-
pushd $workingDir
120-
121-
bundle exec pod gen Development.podspec
122-
cd gen/Development
123-
124-
# Clean the target dir first.
125-
[[ -d "$targetDir" ]] && rm -rf "$targetDir"
126-
mkdir -p "$targetDir"
127-
128-
# Generate the API docs.
129-
for scheme in $workflowSchemes; do
130-
local outputDir="$targetDir/$scheme"
131-
echo "Generating sourcedocs for scheme $scheme to $outputDir..."
132-
sourcedocs generate \
133-
--output-folder "$outputDir" \
134-
-- \
135-
-scheme $scheme \
136-
-workspace Development.xcworkspace
137-
done
138-
popd
139-
140-
echo "Removing working directory..."
141-
rm -rf "$workingDir"
142-
143-
echo "Swift docs finished."
144-
}
145-
14692
# Process arguments. See man zshmodules.
147-
zparseopts -A refs -kotlin-ref: -swift-ref:
93+
zparseopts -A refs -kotlin-ref:
14894
KOTLIN_REF=${refs[--kotlin-ref]}
149-
SWIFT_REF=${refs[--swift-ref]}
15095
if [[ -z $KOTLIN_REF ]]; then
15196
echo "Missing --kotlin-ref argument" >&2
15297
exit 1
15398
fi
154-
if [[ -z "$SWIFT_REF" ]]; then
155-
echo "Missing --swift-ref argument" >&2
156-
exit 1
157-
fi
15899
echo "Deploying from $KOTLIN_REPO at $KOTLIN_REF"
159-
echo "Deploying from $SWIFT_REPO at $SWIFT_REF"
160100

161101
echo "Building Kotlin docs…"
162102
buildKotlinDocs $KOTLIN_REF "$(pwd)/docs/kotlin/api"
163103

164-
echo "Building Swift docs…"
165-
buildSwiftDocs $SWIFT_REF "$(pwd)/docs/swift/api"
166-
167104
# Push the new files up to GitHub.
168-
mkdocsMsg="Deployed docs using mkdocs {version} and script from {sha} from ${KOTLIN_REPO}@$KOTLIN_REF and ${SWIFT_REPO}@$SWIFT_REF"
105+
mkdocsMsg="Deployed docs using mkdocs {version} and script from {sha} from ${KOTLIN_REPO}@$KOTLIN_REF"
169106
if [ -n "$DRY_RUN" ]; then
170107
echo "DRY_RUN enabled, building mkdocs but skipping gh-deploy and push…"
171108
mkdocs build

mkdocs.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,7 @@ nav:
102102
- 'Kotlin Samples 🔗': https://github.com/square/workflow-kotlin/tree/main/samples
103103
- 'API Reference':
104104
- 'Kotlin 🔗': 'kotlin/api/htmlMultiModule'
105-
- 'Swift API':
106-
- 'Workflow ': 'swift/api/Workflow/README.md'
107-
- 'WorkflowReactiveSwift': 'swift/api/WorkflowReactiveSwift/README.md'
108-
- 'WorkflowUI ': 'swift/api/WorkflowUI/README.md'
109-
- 'WorkflowTesting ': 'swift/api/WorkflowTesting/README.md'
105+
- 'Swift 🔗': https://square.github.io/workflow-swift/documentation
110106
- 'Glossary': 'glossary.md'
111107
- 'FAQ': faq.md
112108
- 'Pre-1.0 Resources': historical.md

0 commit comments

Comments
 (0)