Skip to content

Commit 78d173a

Browse files
committed
Dokka workflow updates
1 parent 7d2a47f commit 78d173a

File tree

10 files changed

+101
-48
lines changed

10 files changed

+101
-48
lines changed

.github/workflows/docs.yml

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- 'docs/pages/**'
77
- '.github/workflows/**'
88
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Version of library that is being documented'
12+
required: true
913

1014
permissions:
1115
id-token: write
@@ -21,6 +25,9 @@ env:
2125
ALGOLIA_KEY: '${{ secrets.ALGOLIA_KEY }}'
2226
CONFIG_JSON_PRODUCT: 'kotlinx-rpc'
2327
CONFIG_JSON_VERSION: '0.8.0'
28+
DOKKA_ARTIFACT: 'dokka.zip'
29+
ASSEMBLE_DIR: '__docs_assembled'
30+
ASSEMBLE_ARTIFACT: 'assembled.zip'
2431

2532
jobs:
2633
build:
@@ -67,11 +74,8 @@ jobs:
6774
with:
6875
instance: ${{ env.INSTANCE }}
6976

70-
deploy:
77+
assemble:
7178
if: github.event_name == 'workflow_dispatch'
72-
environment:
73-
name: github-pages
74-
url: ${{ steps.deployment.outputs.page_url }}
7579
needs: [ build, test ]
7680
runs-on: ubuntu-latest
7781
steps:
@@ -80,58 +84,76 @@ jobs:
8084
with:
8185
fetch-depth: 0
8286

83-
- name: Setup Gradle
84-
uses: gradle/actions/setup-gradle@v4
85-
86-
- name: Run Dokka
87-
run: ./gradlew dokkaGenerate
87+
- name: Download Writerside artifacts
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: kotlinx-rpc
8891

89-
- name: Move API docs to the publication directory
90-
run:
91-
mkdir __docs_publication_dir
92-
cp -r docs/pages/api __docs_publication_dir/api
92+
- name: Unzip Writerside artifacts
93+
run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}
9394

94-
- name: Download artifacts
95+
- name: Download Dokka
9596
uses: actions/download-artifact@v4
9697
with:
97-
name: kotlinx-rpc
98+
name: dokka-${{ inputs.version }}
99+
path: ${{ env.DOKKA_ARTIFACT }}
98100

99-
- name: Unzip artifact
100-
run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d __docs_publication_dir
101+
- name: Unzip Dokka
102+
run: unzip -O UTF-8 -qq '${{ env.DOKKA_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}/api
103+
104+
- name: Move changelog.md to the docs root
105+
run: mv ${{ env.ASSEMBLE_DIR }}/api/changelog.md ${{ env.ASSEMBLE_DIR }}/changelog.md
101106

102107
- name: Update sitemap.xml
103-
run: chmod +x updateSitemap.sh && ./updateSitemap.sh __docs_publication_dir/sitemap.xml __docs_publication_dir/api
108+
run: chmod +x updateSitemap.sh && ./updateSitemap.sh ${{ env.ASSEMBLE_DIR }}/sitemap.xml ${{ env.ASSEMBLE_DIR }}/api
109+
110+
- name: Save assembled artifact
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: kotlinx-rpc-assembled
114+
path: |
115+
${{ env.ASSEMBLE_DIR }}
116+
retention-days: 7
104117

105-
- name: Run Changelog Generator
106-
run: ./gradlew updateDocsChangelog
118+
deploy:
119+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
120+
environment:
121+
name: github-pages
122+
url: ${{ steps.deployment.outputs.page_url }}
123+
needs: [ build, test, assemble ]
124+
runs-on: ubuntu-latest
125+
steps:
126+
- name: Download artifacts
127+
uses: actions/download-artifact@v4
128+
with:
129+
name: kotlinx-rpc-assembled
107130

108-
- name: Move Changelog.md to the publication directory
109-
run:
110-
mv docs/pages/kotlinx-rpc/topics/changelog.md __docs_publication_dir/changelog.md
131+
- name: Unzip artifact
132+
run: unzip -O UTF-8 -qq '${{ env.ASSEMBLE_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}
111133

112134
- name: Setup Pages
113135
uses: actions/configure-pages@v5
114136

115137
- name: Package and upload Pages artifact
116138
uses: actions/upload-pages-artifact@v3
117139
with:
118-
path: __docs_publication_dir
140+
path: ${{ env.ASSEMBLE_DIR }}
119141

120142
- name: Deploy to GitHub Pages
121143
id: deployment
122144
uses: actions/deploy-pages@v4
123145

124146
publish-indexes:
125-
if: github.event_name == 'workflow_dispatch'
126-
needs: [ build, test, deploy ]
147+
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
148+
needs: [ build, test, assemble, deploy ]
127149
runs-on: ubuntu-latest
128150
container:
129151
image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-3
130152
steps:
131153
- name: Download artifact
132154
uses: actions/download-artifact@v4
133155
with:
134-
name: kotlinx-rpc
156+
name: kotlinx-rpc-assembled
135157
- name: Unzip artifact
136158
run: |
137159
unzip -O UTF-8 -qq '${{ env.ALGOLIA_ARTIFACT }}' -d algolia-indexes

.github/workflows/dokka.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Store Dokka Artifact
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version of library that is being documented'
8+
required: true
9+
type: string
10+
buildId:
11+
description: 'TeamCity build id'
12+
required: true
13+
type: string
14+
artifactName:
15+
description: 'Name of artifact to download'
16+
required: true
17+
type: string
18+
19+
jobs:
20+
store-dokka-artifact:
21+
name: Store Dokka Artifact
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Download Dokka artifact
25+
run: |
26+
curl -v -s -f -L \
27+
-H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" \
28+
https://krpc.teamcity.com/app/rest/builds/id:${{ inputs.buildId }}/artifacts/content/${{ inputs.artifactName }} -o dokka.zip
29+
- name: Save artifact
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: dokka-${{ inputs.version }}
33+
path: dokka.zip
34+
retention-days: 21

compiler-plugin/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ kotlin.code.style=official
66

77
kotlin.native.ignoreDisabledTargets=true
88

9-
kotlin.daemon.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError
9+
kotlin.daemon.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError
1010
kotlin.daemon.useFallbackStrategy=false
1111

12-
org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
12+
org.gradle.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
1313
org.gradle.daemon=true
1414
org.gradle.parallel=true
1515
org.gradle.workers.max=8

dokka-plugin/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ kotlin.code.style=official
66

77
kotlin.native.ignoreDisabledTargets=true
88

9-
kotlin.daemon.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError
9+
kotlin.daemon.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError
1010
kotlin.daemon.useFallbackStrategy=false
1111

12-
org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
12+
org.gradle.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
1313
org.gradle.daemon=true
1414
org.gradle.parallel=true
1515
org.gradle.workers.max=8

gradle-conventions/src/main/kotlin/conventions-dokka-spec.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
66
import util.KOTLINX_RPC_PREFIX
7-
import util.other.asDokkaVersion
87
import util.other.libs
98
import java.time.Year
109

@@ -24,7 +23,7 @@ dokka {
2423
dokkaSourceSets.configureEach {
2524
sourceLink {
2625
localDirectory = rootDir
27-
remoteUrl("https://github.com/Kotlin/kotlinx-rpc/blob/${libs.versions.kotlinx.rpc.get().asDokkaVersion()}")
26+
remoteUrl("https://github.com/Kotlin/kotlinx-rpc/blob/${libs.versions.kotlinx.rpc.get()}")
2827
remoteLineSuffix = "#L"
2928

3029
documentedVisibilities = setOf(

gradle-conventions/src/main/kotlin/conventions-gradle-doctor.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ plugins {
88

99
doctor {
1010
enableTestCaching.assign(false)
11-
warnWhenNotUsingParallelGC.assign(true)
1211
disallowMultipleDaemons.assign(false)
1312
GCFailThreshold.assign(0.5f)
1413
}

gradle-conventions/src/main/kotlin/conventions-root.gradle.kts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
import util.other.asDokkaVersion
65
import util.other.libs
76
import util.tasks.configureNpm
87
import util.tasks.registerChangelogTask
@@ -29,9 +28,9 @@ allprojects {
2928
}
3029

3130
dokka {
32-
val libDokkaVersion = libs.versions.kotlinx.rpc.get().asDokkaVersion()
31+
val libVersion = libs.versions.kotlinx.rpc.get()
3332

34-
moduleVersion.set(libDokkaVersion)
33+
moduleVersion.set(libVersion)
3534

3635
val pagesDirectory = layout.projectDirectory
3736
.dir("docs")
@@ -63,6 +62,13 @@ dokka {
6362
outputDirectory = dokkaVersionsDirectory
6463
}
6564

65+
tasks.dokkaGenerate {
66+
doFirst {
67+
dokkaVersionsDirectory.mkdirs()
68+
dokkaVersionsDirectory.resolve("version.txt").writeText(libVersion)
69+
}
70+
}
71+
6672
tasks.clean {
6773
delete(dokkaVersionsDirectory)
6874
}

gradle-conventions/src/main/kotlin/util/other/dokkaUtil.kt

Lines changed: 0 additions & 7 deletions
This file was deleted.

gradle-plugin/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ kotlin.code.style=official
66

77
kotlin.native.ignoreDisabledTargets=true
88

9-
kotlin.daemon.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError
9+
kotlin.daemon.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError
1010
kotlin.daemon.useFallbackStrategy=false
1111

12-
org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
12+
org.gradle.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
1313
org.gradle.daemon=true
1414
org.gradle.parallel=true
1515
org.gradle.workers.max=8

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ kotlin.code.style=official
66

77
kotlin.native.ignoreDisabledTargets=true
88

9-
kotlin.daemon.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError
9+
kotlin.daemon.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError
1010
kotlin.daemon.useFallbackStrategy=false
1111

12-
org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
12+
org.gradle.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
1313
org.gradle.daemon=true
1414
org.gradle.parallel=true
1515
org.gradle.workers.max=8

0 commit comments

Comments
 (0)