|
22 | 22 | # pip install -r requirements.txt
|
23 | 23 | # Preview the site as you're editing it with:
|
24 | 24 | # mkdocs serve
|
25 |
| -# It also uses CocoaPods and Sourcedocs to build the Swift docs. |
26 |
| -# See .buildscript/build_swift_docs.sh for setup info. |
27 | 25 | #
|
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 |
29 | 27 | # Set the DRY_RUN environment variable to any non-null value to skip the actual deploy.
|
30 | 28 | # A custom username/password can be used to authenticate to the git repo by setting
|
31 | 29 | # the GIT_USERNAME and GIT_PASSWORD environment variables.
|
32 | 30 | #
|
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 |
34 | 32 |
|
35 | 33 | # Automatically exit the script on error.
|
36 | 34 | set -e
|
37 | 35 |
|
38 | 36 | KOTLIN_REPO=square/workflow-kotlin
|
39 |
| -SWIFT_REPO=square/workflow-swift |
40 | 37 |
|
41 | 38 | if [ -z "$WORKFLOW_GOOGLE_ANALYTICS_KEY" ]; then
|
42 | 39 | echo "Must set WORKFLOW_GOOGLE_ANALYTICS_KEY to deploy." >&2
|
@@ -92,80 +89,20 @@ function buildKotlinDocs() {
|
92 | 89 | echo "Kotlin docs finished."
|
93 | 90 | }
|
94 | 91 |
|
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 |
| - |
146 | 92 | # Process arguments. See man zshmodules.
|
147 |
| -zparseopts -A refs -kotlin-ref: -swift-ref: |
| 93 | +zparseopts -A refs -kotlin-ref: |
148 | 94 | KOTLIN_REF=${refs[--kotlin-ref]}
|
149 |
| -SWIFT_REF=${refs[--swift-ref]} |
150 | 95 | if [[ -z $KOTLIN_REF ]]; then
|
151 | 96 | echo "Missing --kotlin-ref argument" >&2
|
152 | 97 | exit 1
|
153 | 98 | fi
|
154 |
| -if [[ -z "$SWIFT_REF" ]]; then |
155 |
| - echo "Missing --swift-ref argument" >&2 |
156 |
| - exit 1 |
157 |
| -fi |
158 | 99 | echo "Deploying from $KOTLIN_REPO at $KOTLIN_REF"
|
159 |
| -echo "Deploying from $SWIFT_REPO at $SWIFT_REF" |
160 | 100 |
|
161 | 101 | echo "Building Kotlin docs…"
|
162 | 102 | buildKotlinDocs $KOTLIN_REF "$(pwd)/docs/kotlin/api"
|
163 | 103 |
|
164 |
| -echo "Building Swift docs…" |
165 |
| -buildSwiftDocs $SWIFT_REF "$(pwd)/docs/swift/api" |
166 |
| - |
167 | 104 | # 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" |
169 | 106 | if [ -n "$DRY_RUN" ]; then
|
170 | 107 | echo "DRY_RUN enabled, building mkdocs but skipping gh-deploy and push…"
|
171 | 108 | mkdocs build
|
|
0 commit comments