6
6
- ' docs/pages/**'
7
7
- ' .github/workflows/**'
8
8
workflow_dispatch :
9
+ inputs :
10
+ version :
11
+ description : ' Version of library that is being documented'
12
+ required : true
9
13
10
14
permissions :
11
15
id-token : write
21
25
ALGOLIA_KEY : ' ${{ secrets.ALGOLIA_KEY }}'
22
26
CONFIG_JSON_PRODUCT : ' kotlinx-rpc'
23
27
CONFIG_JSON_VERSION : ' 0.8.0'
28
+ DOKKA_ARTIFACT : ' dokka.zip'
29
+ ASSEMBLE_DIR : ' __docs_assembled'
30
+ ASSEMBLE_ARTIFACT : ' assembled.zip'
24
31
25
32
jobs :
26
33
build :
67
74
with :
68
75
instance : ${{ env.INSTANCE }}
69
76
70
- deploy :
77
+ assemble :
71
78
if : github.event_name == 'workflow_dispatch'
72
- environment :
73
- name : github-pages
74
- url : ${{ steps.deployment.outputs.page_url }}
75
79
needs : [ build, test ]
76
80
runs-on : ubuntu-latest
77
81
steps :
@@ -80,58 +84,76 @@ jobs:
80
84
with :
81
85
fetch-depth : 0
82
86
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
88
91
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 }}
93
94
94
- - name : Download artifacts
95
+ - name : Download Dokka
95
96
uses : actions/download-artifact@v4
96
97
with :
97
- name : kotlinx-rpc
98
+ name : dokka-${{ inputs.version }}
99
+ path : ${{ env.DOKKA_ARTIFACT }}
98
100
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
101
106
102
107
- 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
104
117
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
107
130
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 }}
111
133
112
134
- name : Setup Pages
113
135
uses : actions/configure-pages@v5
114
136
115
137
- name : Package and upload Pages artifact
116
138
uses : actions/upload-pages-artifact@v3
117
139
with :
118
- path : __docs_publication_dir
140
+ path : ${{ env.ASSEMBLE_DIR }}
119
141
120
142
- name : Deploy to GitHub Pages
121
143
id : deployment
122
144
uses : actions/deploy-pages@v4
123
145
124
146
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 ]
127
149
runs-on : ubuntu-latest
128
150
container :
129
151
image : registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-3
130
152
steps :
131
153
- name : Download artifact
132
154
uses : actions/download-artifact@v4
133
155
with :
134
- name : kotlinx-rpc
156
+ name : kotlinx-rpc-assembled
135
157
- name : Unzip artifact
136
158
run : |
137
159
unzip -O UTF-8 -qq '${{ env.ALGOLIA_ARTIFACT }}' -d algolia-indexes
0 commit comments