7
7
- ' .github/workflows/**'
8
8
workflow_dispatch :
9
9
inputs :
10
- version :
11
- description : ' Version of library that is being documented'
10
+ asset_id :
11
+ description : ' Id of Dokka artifact.'
12
+ required : true
13
+ dry_run :
14
+ type : boolean
15
+ description : " Dry run. If set to true, the action will not actually publish the pages, but will assemble the artifact."
16
+ default : true
12
17
required : true
13
18
14
19
permissions :
15
20
id-token : write
16
21
pages : write
22
+ contents : read
17
23
18
24
env :
19
25
INSTANCE : ' kotlinx-rpc/rpc'
@@ -90,10 +96,26 @@ jobs:
90
96
run : unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}
91
97
92
98
- name : Download Dokka
93
- uses : actions/download-artifact@v4
94
- with :
95
- name : dokka-${{ inputs.version }}
96
- path : ${{ env.DOKKA_ARTIFACT }}
99
+ run : |
100
+ if [ -z "${{ inputs.asset_id }}" ]; then
101
+ echo "'asset_id' is not set"
102
+ exit 1
103
+ fi
104
+
105
+ echo "Downloading Dokka artifact, asset id: ${{ inputs.asset_id }}"
106
+ echo "Url: https://api.github.com/repos/Kotlin/kotlinx-rpc/releases/assets/${{ inputs.asset_id }}"
107
+ echo "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"
108
+
109
+ curl -v -s -f -L \ ─╯
110
+ -H "Accept: application/octet-stream" \
111
+ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
112
+ -H "X-GitHub-Api-Version: 2022-11-28" \
113
+ https://api.github.com/repos/Kotlin/kotlinx-rpc/releases/assets/${{ inputs.asset_id }} -o ${{ env.DOKKA_ARTIFACT }}
114
+
115
+ if [ -z "$(ls | grep -x ${{ env.DOKKA_ARTIFACT }})" ]; then
116
+ echo "Failed to download Dokka artifact, asset id: ${{ inputs.asset_id }}"
117
+ exit 1
118
+ fi
97
119
98
120
- name : Unzip Dokka
99
121
run : unzip -O UTF-8 -qq '${{ env.DOKKA_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}/api
@@ -110,7 +132,7 @@ jobs:
110
132
retention-days : 7
111
133
112
134
deploy :
113
- if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
135
+ if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
114
136
environment :
115
137
name : github-pages
116
138
url : ${{ steps.deployment.outputs.page_url }}
@@ -138,7 +160,7 @@ jobs:
138
160
uses : actions/deploy-pages@v4
139
161
140
162
publish-indexes :
141
- if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
163
+ if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && !inputs.dry_run
142
164
needs : [ build, test, assemble, deploy ]
143
165
runs-on : ubuntu-latest
144
166
container :
0 commit comments